diff options
| author | soryu <soryu@soryu.co> | 2026-01-06 04:08:11 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-11 03:01:13 +0000 |
| commit | 8b17a175c3e7e27b789812eba4e3cd760beadb10 (patch) | |
| tree | 7864dcaa2fa9db47fdfd4e8bfdb0b1dde832aa33 /makima/migrations/20250107000000_simplify_task_depth.sql | |
| parent | f79c416c58557d2f946aa5332989afdfa8c021cd (diff) | |
| download | soryu-8b17a175c3e7e27b789812eba4e3cd760beadb10.tar.gz soryu-8b17a175c3e7e27b789812eba4e3cd760beadb10.zip | |
Initial Control system
Diffstat (limited to 'makima/migrations/20250107000000_simplify_task_depth.sql')
| -rw-r--r-- | makima/migrations/20250107000000_simplify_task_depth.sql | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/makima/migrations/20250107000000_simplify_task_depth.sql b/makima/migrations/20250107000000_simplify_task_depth.sql new file mode 100644 index 0000000..73e4ba0 --- /dev/null +++ b/makima/migrations/20250107000000_simplify_task_depth.sql @@ -0,0 +1,18 @@ +-- Simplify task hierarchy to only 2 levels: orchestrator (depth 0) and subtasks (depth 1) +-- Subtasks cannot have their own children + +-- First, check for any existing depth-2 tasks and fail if found +DO $$ +BEGIN + IF EXISTS (SELECT 1 FROM tasks WHERE depth >= 2) THEN + RAISE EXCEPTION 'Cannot migrate: tasks with depth >= 2 exist. Please flatten or delete these tasks first.'; + END IF; +END $$; + +-- Drop the old constraint +ALTER TABLE tasks DROP CONSTRAINT IF EXISTS tasks_depth_check; + +-- Add new stricter constraint (max depth 1) +ALTER TABLE tasks ADD CONSTRAINT tasks_depth_check CHECK (depth >= 0 AND depth < 2); + +COMMENT ON COLUMN tasks.depth IS 'Task hierarchy depth: 0=orchestrator (top-level), 1=subtask. Maximum depth is 1.'; |
