- Update SpoolPresetRepository to include user_id in the update query. - Expand .gitignore to include various environment and temporary files. - Revise agent documentation for better clarity and formatting. - Implement pull-to-refresh functionality in the inventory list. - Integrate API calls for deleting and updating filaments, ensuring state synchronization. - Add custom color picker for filament color selection with hex validation. - Update AndroidManifest and Gradle files for improved configuration and permissions. - Refactor MainActivity and MainApplication for better splash screen handling. - Update styles and colors for a cohesive UI experience. - Replace splash screen logos and icons with new assets.
31 lines
1.3 KiB
SQL
31 lines
1.3 KiB
SQL
-- Migration: 002 - Criar tabela de presets de carretel e inserir presets do sistema
|
|
|
|
CREATE TABLE spool_presets (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
|
|
name TEXT NOT NULL,
|
|
spool_weight_g INTEGER NOT NULL CHECK (spool_weight_g > 0),
|
|
is_system BOOLEAN NOT NULL DEFAULT FALSE,
|
|
user_id UUID REFERENCES users (id) ON DELETE CASCADE,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
|
|
-- Presets do sistema não têm user_id; presets customizados têm
|
|
CONSTRAINT chk_preset_ownership CHECK (
|
|
(is_system = TRUE AND user_id IS NULL) OR
|
|
(is_system = FALSE AND user_id IS NOT NULL)
|
|
)
|
|
);
|
|
|
|
CREATE INDEX idx_spool_presets_user_id ON spool_presets (user_id) WHERE user_id IS NOT NULL;
|
|
CREATE INDEX idx_spool_presets_is_system ON spool_presets (is_system);
|
|
|
|
-- Presets built-in do sistema (somente leitura para usuários)
|
|
INSERT INTO spool_presets (name, spool_weight_g, is_system) VALUES
|
|
('Bambu Lab (Plástico)', 250, TRUE),
|
|
('Elegoo (Papelão)', 156, TRUE),
|
|
('Creality (Plástico)', 230, TRUE),
|
|
('Prusament (Plástico)', 201, TRUE),
|
|
('Sunlu (Papelão)', 200, TRUE),
|
|
('Polymaker (Plástico)', 220, TRUE),
|
|
('Genérico Papelão 1kg', 200, TRUE),
|
|
('Genérico Plástico 1kg', 250, TRUE);
|