diff options
Diffstat (limited to 'migrations')
| -rw-r--r-- | migrations/026_task_chains.sql | 16 | ||||
| -rw-r--r-- | migrations/027_maintenance_buckets.sql | 18 |
2 files changed, 34 insertions, 0 deletions
diff --git a/migrations/026_task_chains.sql b/migrations/026_task_chains.sql new file mode 100644 index 0000000..5ed14d7 --- /dev/null +++ b/migrations/026_task_chains.sql @@ -0,0 +1,16 @@ +-- Linear task chains: a fixed, ordered sequence of native tasks with a WIP +-- limit of exactly 1 -- only the task at the current position is ever +-- unlocked/actionable. Completing it unlocks the next position; completing +-- the last position marks the chain completed instead. +CREATE TABLE task_chains ( + id TEXT PRIMARY KEY, + project_id TEXT NOT NULL, + status TEXT NOT NULL DEFAULT 'active', + created_at DATETIME DEFAULT CURRENT_TIMESTAMP +); + +ALTER TABLE native_tasks ADD COLUMN chain_id TEXT DEFAULT ''; +ALTER TABLE native_tasks ADD COLUMN chain_position INTEGER DEFAULT 0; +ALTER TABLE native_tasks ADD COLUMN chain_unlocked BOOLEAN DEFAULT 0; + +CREATE INDEX IF NOT EXISTS idx_native_tasks_chain ON native_tasks(chain_id); diff --git a/migrations/027_maintenance_buckets.sql b/migrations/027_maintenance_buckets.sql new file mode 100644 index 0000000..50c6d7e --- /dev/null +++ b/migrations/027_maintenance_buckets.sql @@ -0,0 +1,18 @@ +-- Recurring maintenance buckets: a finite pool of native_tasks that get +-- repeatedly activated/deactivated (state flip, not a new row per cycle, +-- unlike due-date recurrence) every cycle_days, picking pick_n dormant +-- items per cycle. +CREATE TABLE maintenance_buckets ( + id TEXT PRIMARY KEY, + name TEXT NOT NULL, + cycle_days INTEGER NOT NULL, + pick_n INTEGER NOT NULL, + last_cycle_at DATETIME, + created_at DATETIME DEFAULT CURRENT_TIMESTAMP +); + +ALTER TABLE native_tasks ADD COLUMN bucket_id TEXT DEFAULT ''; +ALTER TABLE native_tasks ADD COLUMN bucket_state TEXT DEFAULT ''; +ALTER TABLE native_tasks ADD COLUMN bucket_last_active_at DATETIME; + +CREATE INDEX IF NOT EXISTS idx_native_tasks_bucket ON native_tasks(bucket_id); |
