diff options
| author | soryu <soryu@soryu.co> | 2026-02-15 01:00:13 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-15 01:00:13 +0000 |
| commit | 33a16597aaca4179707d66e5052d4512218627c6 (patch) | |
| tree | ce5bbf6f9ec1b1ab4bc2568a21fb4cf5dd0f9dd0 /makima/migrations/20260214000000_create_orders.sql | |
| parent | 9aadbc7958d39d181c0dd0600e2b7c30bb6c391a (diff) | |
| download | soryu-33a16597aaca4179707d66e5052d4512218627c6.tar.gz soryu-33a16597aaca4179707d66e5052d4512218627c6.zip | |
Fixup: override order table
Diffstat (limited to 'makima/migrations/20260214000000_create_orders.sql')
| -rw-r--r-- | makima/migrations/20260214000000_create_orders.sql | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/makima/migrations/20260214000000_create_orders.sql b/makima/migrations/20260214000000_create_orders.sql index cb2fbae..cbccbe1 100644 --- a/makima/migrations/20260214000000_create_orders.sql +++ b/makima/migrations/20260214000000_create_orders.sql @@ -2,7 +2,7 @@ -- Orders represent planned work items (features, bugs, spikes) that can later be -- attached to directives (as steps) or contracts for execution. -CREATE TABLE orders ( +CREATE TABLE IF NOT EXISTS orders ( id UUID PRIMARY KEY DEFAULT gen_random_uuid(), owner_id UUID NOT NULL REFERENCES owners(id) ON DELETE CASCADE, title VARCHAR(500) NOT NULL, @@ -29,10 +29,10 @@ CREATE TABLE orders ( ); -- Index for listing orders by owner -CREATE INDEX idx_orders_owner_id ON orders(owner_id); +CREATE INDEX IF NOT EXISTS idx_orders_owner_id ON orders(owner_id); -- Composite index for filtering by owner + status (common query pattern) -CREATE INDEX idx_orders_owner_status ON orders(owner_id, status); +CREATE INDEX IF NOT EXISTS idx_orders_owner_status ON orders(owner_id, status); -- Index for looking up orders linked to a directive -CREATE INDEX idx_orders_directive_id ON orders(directive_id); +CREATE INDEX IF NOT EXISTS idx_orders_directive_id ON orders(directive_id); -- Index for looking up orders linked to a contract -CREATE INDEX idx_orders_contract_id ON orders(contract_id); +CREATE INDEX IF NOT EXISTS idx_orders_contract_id ON orders(contract_id); |
