summaryrefslogtreecommitdiff
path: root/makima/migrations/20250114000001_task_checkpoints.sql
diff options
context:
space:
mode:
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';