summaryrefslogtreecommitdiff
path: root/makima/migrations/20260214000000_create_orders.sql
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-02-14 21:29:26 +0000
committerGitHub <noreply@github.com>2026-02-14 21:29:26 +0000
commit9aadbc7958d39d181c0dd0600e2b7c30bb6c391a (patch)
treeef8bed9718c39041191b58a284ee31f5d8d32521 /makima/migrations/20260214000000_create_orders.sql
parentc1e55ce4fec79f9909b957f86bd7fa8b76939746 (diff)
downloadsoryu-9aadbc7958d39d181c0dd0600e2b7c30bb6c391a.tar.gz
soryu-9aadbc7958d39d181c0dd0600e2b7c30bb6c391a.zip
Makima system improvements: Orders, directive questions, PR creation fix, bug fixes (#62)
* feat: soryu-co/soryu - makima: Fix directive goal update bug - stale closure issue * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Create Orders database schema and backend API * feat: soryu-co/soryu - makima: Fix task Claude instance not receiving user inputs from input box * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Build Orders frontend page replacing the Board page * WIP: heartbeat checkpoint * WIP: heartbeat checkpoint * feat: soryu-co/soryu - makima: Fix directive PR creation system
Diffstat (limited to 'makima/migrations/20260214000000_create_orders.sql')
-rw-r--r--makima/migrations/20260214000000_create_orders.sql38
1 files changed, 38 insertions, 0 deletions
diff --git a/makima/migrations/20260214000000_create_orders.sql b/makima/migrations/20260214000000_create_orders.sql
new file mode 100644
index 0000000..cb2fbae
--- /dev/null
+++ b/makima/migrations/20260214000000_create_orders.sql
@@ -0,0 +1,38 @@
+-- Orders system: card-based issue tracker (similar to Linear/Jira/GitHub Issues).
+-- Orders represent planned work items (features, bugs, spikes) that can later be
+-- attached to directives (as steps) or contracts for execution.
+
+CREATE TABLE 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,
+ description TEXT,
+ -- Priority: critical > high > medium > low > none
+ priority VARCHAR(32) NOT NULL DEFAULT 'medium'
+ CHECK (priority IN ('critical', 'high', 'medium', 'low', 'none')),
+ -- Status lifecycle: open -> in_progress -> done | archived
+ status VARCHAR(32) NOT NULL DEFAULT 'open'
+ CHECK (status IN ('open', 'in_progress', 'done', 'archived')),
+ -- Type of work item
+ order_type VARCHAR(32) NOT NULL DEFAULT 'feature'
+ CHECK (order_type IN ('feature', 'bug', 'spike', 'chore', 'improvement')),
+ -- Flexible labels stored as JSON array of strings
+ labels JSONB NOT NULL DEFAULT '[]',
+ -- Optional links to directives, directive steps, and contracts
+ directive_id UUID REFERENCES directives(id) ON DELETE SET NULL,
+ directive_step_id UUID REFERENCES directive_steps(id) ON DELETE SET NULL,
+ contract_id UUID REFERENCES contracts(id) ON DELETE SET NULL,
+ -- Repository context
+ repository_url VARCHAR(512),
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+ updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
+);
+
+-- Index for listing orders by owner
+CREATE INDEX 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);
+-- Index for looking up orders linked to a directive
+CREATE INDEX 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);