Archon/migrations/007_drop_legacy_columns.sql
Rasmus Widing c89e3647b4
Drop legacy isolation columns (Phase 4) (#99)
Complete migration to work-centric isolation model by removing:
- worktree_path column
- isolation_env_id_legacy column
- isolation_provider column
- Legacy fallback patterns in code
- Migration helper functions

The codebase now exclusively uses isolation_env_id (UUID FK) for all
isolation references. This removes ~190 lines of technical debt.
2025-12-17 20:12:11 +02:00

27 lines
1.1 KiB
SQL

-- Drop legacy isolation columns
-- Version: 7.0
-- Description: Complete migration to work-centric isolation model
-- PREREQUISITE: Run verification query to ensure no orphaned data before applying!
--
-- Verification query (should return 0 rows):
-- SELECT id, platform_conversation_id, worktree_path, isolation_env_id_legacy
-- FROM remote_agent_conversations
-- WHERE (worktree_path IS NOT NULL OR isolation_env_id_legacy IS NOT NULL)
-- AND isolation_env_id IS NULL;
-- Drop columns (order matters - drop FK references first if any)
ALTER TABLE remote_agent_conversations
DROP COLUMN IF EXISTS worktree_path;
ALTER TABLE remote_agent_conversations
DROP COLUMN IF EXISTS isolation_env_id_legacy;
ALTER TABLE remote_agent_conversations
DROP COLUMN IF EXISTS isolation_provider;
-- Drop the legacy index created in migration 005 (if it exists)
DROP INDEX IF EXISTS idx_conversations_isolation;
-- Add comment for documentation
COMMENT ON COLUMN remote_agent_conversations.isolation_env_id IS
'UUID reference to isolation_environments table (the only isolation reference)';