chore: upload parte 2 - assets

This commit is contained in:
2026-06-01 15:36:16 +01:00
parent 9c14a19a87
commit 91b09365a6
37 changed files with 567 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
-- Drop old pick_lists tables
DROP TABLE IF EXISTS pick_list_items CASCADE;
DROP TABLE IF EXISTS pick_lists CASCADE;
-- Planning history: one row per accepted production plan
CREATE TABLE IF NOT EXISTS planning_history (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
status VARCHAR(50) DEFAULT 'accepted',
products_json JSONB,
summary_json JSONB,
created_at TIMESTAMP DEFAULT NOW()
);
-- Planning history items: every BOM component for that plan
CREATE TABLE IF NOT EXISTS planning_history_items (
id SERIAL PRIMARY KEY,
planning_id INTEGER NOT NULL REFERENCES planning_history(id) ON DELETE CASCADE,
component_id INTEGER REFERENCES components(id),
part_number VARCHAR(100),
component_name VARCHAR(255),
category_name VARCHAR(255),
package_type VARCHAR(100),
shelf_location VARCHAR(100),
quantity_needed NUMERIC DEFAULT 0,
stock_at_time NUMERIC DEFAULT 0,
shortage NUMERIC DEFAULT 0,
unit_price NUMERIC DEFAULT 0,
is_internal BOOLEAN DEFAULT false,
manufacturer VARCHAR(255),
supplier VARCHAR(255),
supplier_part_number VARCHAR(255),
sources_json JSONB,
created_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_planning_history_items_planning ON planning_history_items(planning_id);