CUB-111: design PostgreSQL schema for Extrudex Go backend
Some checks failed
Dev Build / build-test (pull_request) Failing after 1m38s
Some checks failed
Dev Build / build-test (pull_request) Failing after 1m38s
- Add migration 000001: initial schema with all lookup tables, core entities, and app settings table - Add migration 000002: seed data for printer types, job statuses, material bases, finishes, modifiers, and default settings - Add Go model structs in internal/models with json tags and pointer types for nullable fields - Add go.mod with pgx dependency Key decisions: - FK ON DELETE: RESTRICT on material_base/finish/printer, SET NULL on optional parents (modifier, spool on print_jobs), CASCADE for usage_logs - Soft-delete (deleted_at) on spools and print_jobs - Lookup tables for printer_type and job_status (no raw enums) - Partial indexes for active spools, barcode scans, low-stock queries - Settings table with JSONB values for flexible app config - All identifiers snake_case
This commit is contained in:
15
backend/migrations/000002_seed_data.down.sql
Normal file
15
backend/migrations/000002_seed_data.down.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
-- Migration: 000002_seed_data (rollback)
|
||||
-- Description: Remove seed data inserted in 000002
|
||||
-- Author: Hex
|
||||
-- Date: 2026-05-06
|
||||
|
||||
BEGIN;
|
||||
|
||||
DELETE FROM settings WHERE key IN ('default_low_stock_threshold_grams', 'default_diameter_mm', 'filament_cross_section_area_mm2');
|
||||
DELETE FROM material_modifiers WHERE id IN (1, 2, 3, 4);
|
||||
DELETE FROM material_finishes WHERE id IN (1, 2, 3, 4, 5);
|
||||
DELETE FROM material_bases WHERE id IN (1, 2, 3, 4, 5, 6, 7);
|
||||
DELETE FROM job_statuses WHERE id IN (1, 2, 3, 4, 5, 6);
|
||||
DELETE FROM printer_types WHERE id IN (1, 2);
|
||||
|
||||
COMMIT;
|
||||
Reference in New Issue
Block a user