From 310d17b25d8dbcd8e930148334e7bd7bb144f407 Mon Sep 17 00:00:00 2001 From: Peter Stone Date: Thu, 16 Jul 2026 06:08:23 +0000 Subject: Add schema for task budgets and availability blocks Creates migrations/025_task_budgets_and_availability.sql with: - New availability_blocks table for manual weekly availability templates - estimated_minutes column on native_tasks for time budgeting - budget_tracked flag on projects and labels for opt-in tracking Fixes pre-existing bug in sqlite_test.go's setupTestStoreWithNativeTasks where project_id column was missing from the schema, causing test failures. Updates all hand-rolled test helpers (sqlite_test.go, native_tasks_test.go) to include the new columns, and adds availability_test.go with newAvailabilityTestStore helper for Task 4's availability CRUD tests. All store tests pass, including the two that were previously failing (TestGetNativeTasksByDateRange_ExcludesOverdue, TestGetOverdueNativeTasks_IncludesOnlyPastDue). Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01PQaPGQVSfmKUiHXB87qRTC --- migrations/025_task_budgets_and_availability.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 migrations/025_task_budgets_and_availability.sql (limited to 'migrations') diff --git a/migrations/025_task_budgets_and_availability.sql b/migrations/025_task_budgets_and_availability.sql new file mode 100644 index 0000000..3fd945d --- /dev/null +++ b/migrations/025_task_budgets_and_availability.sql @@ -0,0 +1,14 @@ +-- Opt-in time-budget visibility: a manual weekly availability template, +-- per-task time estimates, and a budget-tracked flag on projects/labels so +-- only tasks the user has opted in count against any budget calculation. +CREATE TABLE availability_blocks ( + id TEXT PRIMARY KEY, + weekday INTEGER NOT NULL, -- 0-6, Sun-Sat + start_time TEXT NOT NULL, -- "18:00" + end_time TEXT NOT NULL, -- "20:00" + label TEXT DEFAULT '' +); + +ALTER TABLE native_tasks ADD COLUMN estimated_minutes INTEGER DEFAULT 0; +ALTER TABLE projects ADD COLUMN budget_tracked BOOLEAN DEFAULT 0; +ALTER TABLE labels ADD COLUMN budget_tracked BOOLEAN DEFAULT 0; -- cgit v1.2.3