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
+17
View File
@@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS stock_transactions (
id SERIAL PRIMARY KEY,
component_id INTEGER NOT NULL REFERENCES components(id) ON DELETE CASCADE,
transaction_type VARCHAR(20) NOT NULL DEFAULT 'purchase',
quantity INTEGER NOT NULL,
unit_cost NUMERIC(12,4) DEFAULT 0,
total_cost NUMERIC(12,4) DEFAULT 0,
supplier VARCHAR(255),
supplier_part_number VARCHAR(100),
order_reference VARCHAR(255),
notes TEXT,
created_at TIMESTAMPTZ DEFAULT NOW()
);
CREATE INDEX IF NOT EXISTS idx_stock_tx_component ON stock_transactions(component_id);
CREATE INDEX IF NOT EXISTS idx_stock_tx_created ON stock_transactions(created_at DESC);
CREATE INDEX IF NOT EXISTS idx_stock_tx_type ON stock_transactions(transaction_type);