summaryrefslogtreecommitdiff
path: root/makima/migrations/20250114000001_task_checkpoints.sql
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-01-11 05:52:14 +0000
committersoryu <soryu@soryu.co>2026-01-15 00:21:16 +0000
commit87044a747b47bd83249d61a45842c7f7b2eae56d (patch)
treeef2000ce79ffcc2723ef841acef5aa1deb1d5378 /makima/migrations/20250114000001_task_checkpoints.sql
parent077820c4167c168072d217a1b01df840463a12a8 (diff)
downloadsoryu-87044a747b47bd83249d61a45842c7f7b2eae56d.tar.gz
soryu-87044a747b47bd83249d61a45842c7f7b2eae56d.zip
Contract system
Diffstat (limited to 'makima/migrations/20250114000001_task_checkpoints.sql')
-rw-r--r--makima/migrations/20250114000001_task_checkpoints.sql24
1 files changed, 24 insertions, 0 deletions
diff --git a/makima/migrations/20250114000001_task_checkpoints.sql b/makima/migrations/20250114000001_task_checkpoints.sql
new file mode 100644
index 0000000..8692466
--- /dev/null
+++ b/makima/migrations/20250114000001_task_checkpoints.sql
@@ -0,0 +1,24 @@
+-- Task checkpoints table for tracking git commit history per task
+-- Enables branching from any checkpoint
+
+CREATE TABLE IF NOT EXISTS task_checkpoints (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ task_id UUID NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
+ checkpoint_number INTEGER NOT NULL,
+ commit_sha VARCHAR(40) NOT NULL,
+ branch_name VARCHAR(255) NOT NULL,
+ message TEXT NOT NULL,
+ files_changed JSONB, -- Array of {path, action: 'A'|'M'|'D'}
+ lines_added INTEGER DEFAULT 0,
+ lines_removed INTEGER DEFAULT 0,
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+
+ UNIQUE(task_id, checkpoint_number)
+);
+
+CREATE INDEX idx_task_checkpoints_task_id ON task_checkpoints(task_id);
+CREATE INDEX idx_task_checkpoints_commit_sha ON task_checkpoints(commit_sha);
+
+COMMENT ON TABLE task_checkpoints IS 'Git commit history for tasks, enabling branching from any checkpoint';
+COMMENT ON COLUMN task_checkpoints.checkpoint_number IS 'Sequential checkpoint number within this task';
+COMMENT ON COLUMN task_checkpoints.files_changed IS 'JSON array of {path, action} for files modified in this commit';