diff options
| author | soryu <soryu@soryu.co> | 2026-05-18 01:21:30 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-18 01:21:30 +0100 |
| commit | f240675da99bc7705e473b8f70a2628812aa4c10 (patch) | |
| tree | 3ee2d24b431ccb8cd1a3013c86b34a5782a3e224 /makima/migrations | |
| parent | 0d996cf7590e3e52f424859c7d6f0e68640f119e (diff) | |
| download | soryu-master.tar.gz soryu-master.zip | |
The contracts table, supervisor task type, and all their backing
machinery have been inert for several PRs. The directives system reads
its own active contract body for spec text, and PR #135 removed the
last LLM surface that spawned supervisors.
This PR wipes the dead surface in one shot — the user authorised a DB
wipe, so the migration drops every legacy table with CASCADE rather
than carrying forward stub rows. Net change: −12k LOC across handlers,
repository, state, models, the TUI, and the listen module.
What's gone:
- contracts, contract_chat_*, contract_events, contract_repositories,
contract_type_templates tables.
- supervisor_states, supervisor_heartbeats tables.
- mesh_chat_conversations, mesh_chat_messages tables.
- tasks.contract_id/is_supervisor/supervisor_task_id/supervisor_worktree_task_id columns.
- directive_steps.contract_id/contract_type columns.
- files.contract_id/contract_phase columns.
- history_events.contract_id/phase columns.
- The Contract/Supervisor/MeshChat handler + model + repository
surface, plus the daemon TUI views that read them.
- The standalone listen.rs websocket handler (orphaned with the LLM).
What stays:
- mesh_supervisor handler: trimmed to just the questions + orders
backchannel used by `makima directive ask` / `create-order` (kept
the URL prefix for CLI client compat).
- directive_documents (the user-facing "contracts" surface).
- pending_questions in-memory state for the directive Ask flow.
cargo check, cargo test --lib (68 passed), tsc, and vite build all
clean.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'makima/migrations')
| -rw-r--r-- | makima/migrations/20260517000000_drop_legacy_contracts_and_supervisor.sql | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/makima/migrations/20260517000000_drop_legacy_contracts_and_supervisor.sql b/makima/migrations/20260517000000_drop_legacy_contracts_and_supervisor.sql new file mode 100644 index 0000000..bc89ff8 --- /dev/null +++ b/makima/migrations/20260517000000_drop_legacy_contracts_and_supervisor.sql @@ -0,0 +1,58 @@ +-- Drop the legacy contracts + supervisor task-grouping system. +-- +-- Context: contracts were the pre-directive grouping for tasks. The +-- "supervisor" was a special task type (`is_supervisor=true`) that +-- coordinated a tree of subtasks under one contract. Both have been +-- inert for several PRs — no creation path remains, the LLM removal +-- (#135) took out the last surface that spawned them, and the +-- directives system reads its own active contract body for spec text. +-- +-- This migration drops every remnant in one shot. The user authorised +-- a DB wipe; CASCADE is intentional. +-- +-- Survives: +-- * `pending_questions` (in-memory only in server state.rs) — the +-- directive Ask command still uses this backchannel. +-- * `orders` (already had contract_id dropped, line 20260216). +-- * `directive_documents` (the user-facing "contract" surface). + +-- --------------------------------------------------------------------------- +-- Drop FK columns first so the parent tables can go cleanly. +-- --------------------------------------------------------------------------- + +-- Tasks: legacy contract grouping + supervisor flags. +ALTER TABLE tasks DROP COLUMN IF EXISTS contract_id CASCADE; +ALTER TABLE tasks DROP COLUMN IF EXISTS is_supervisor CASCADE; +ALTER TABLE tasks DROP COLUMN IF EXISTS supervisor_task_id CASCADE; +ALTER TABLE tasks DROP COLUMN IF EXISTS supervisor_worktree_task_id CASCADE; + +-- directive_steps: legacy contract-backed step machinery. +ALTER TABLE directive_steps DROP COLUMN IF EXISTS contract_id CASCADE; +ALTER TABLE directive_steps DROP COLUMN IF EXISTS contract_type CASCADE; + +-- files: legacy contract + phase association. +ALTER TABLE files DROP COLUMN IF EXISTS contract_id CASCADE; +ALTER TABLE files DROP COLUMN IF EXISTS contract_phase CASCADE; + +-- history_events: drop contract scope; events stay task-level only. +ALTER TABLE history_events DROP COLUMN IF EXISTS contract_id CASCADE; +ALTER TABLE history_events DROP COLUMN IF EXISTS phase CASCADE; + +-- --------------------------------------------------------------------------- +-- Drop dependent tables. Order is FK-safe: leaf tables first. +-- --------------------------------------------------------------------------- + +DROP TABLE IF EXISTS contract_chat_messages CASCADE; +DROP TABLE IF EXISTS contract_chat_conversations CASCADE; +DROP TABLE IF EXISTS contract_events CASCADE; +DROP TABLE IF EXISTS contract_repositories CASCADE; +DROP TABLE IF EXISTS contract_type_templates CASCADE; + +DROP TABLE IF EXISTS supervisor_heartbeats CASCADE; +DROP TABLE IF EXISTS supervisor_states CASCADE; + +DROP TABLE IF EXISTS mesh_chat_messages CASCADE; +DROP TABLE IF EXISTS mesh_chat_conversations CASCADE; + +-- Final boss: the contracts table itself. +DROP TABLE IF EXISTS contracts CASCADE; |
