chore: upload parte 2 - assets
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user