Phase 1: spec_events + spec_current tables (v1.0.70)
This commit is contained in:
@@ -129,6 +129,32 @@ component rest="true" restPath="db" {
|
||||
old_values JSONB,
|
||||
new_values JSONB,
|
||||
created_at TIMESTAMPTZ DEFAULT now()
|
||||
)",
|
||||
"CREATE TABLE IF NOT EXISTS spec_events (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
contract_id UUID REFERENCES contracts(id),
|
||||
supplement_id UUID REFERENCES supplements(id),
|
||||
seq INTEGER NOT NULL,
|
||||
action TEXT NOT NULL,
|
||||
target_hash TEXT,
|
||||
new_values JSONB,
|
||||
comment TEXT,
|
||||
status TEXT DEFAULT 'applied',
|
||||
created_at TIMESTAMPTZ DEFAULT now(),
|
||||
UNIQUE(contract_id, seq)
|
||||
)",
|
||||
"CREATE TABLE IF NOT EXISTS spec_current (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
contract_id UUID REFERENCES contracts(id),
|
||||
name_hash TEXT NOT NULL,
|
||||
name TEXT,
|
||||
price NUMERIC,
|
||||
qty NUMERIC,
|
||||
sum NUMERIC,
|
||||
date_start TEXT,
|
||||
last_event_id UUID REFERENCES spec_events(id),
|
||||
updated_at TIMESTAMPTZ DEFAULT now(),
|
||||
UNIQUE(contract_id, name_hash)
|
||||
)"
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user