-- Migration: Central Gitea + Unified Actor (changes.md Phase 6) -- Renames/replaces per-user Gitea fields with central Gitea repo references. -- Simplifies actors table for unified user actor model. -- Adds version tracking columns. -- 1. Drop old per-user Gitea columns from user_stacks ALTER TABLE user_stacks DROP COLUMN IF EXISTS gitea_container_id; ALTER TABLE user_stacks DROP COLUMN IF EXISTS gitea_container_name; ALTER TABLE user_stacks DROP COLUMN IF EXISTS gitea_host; ALTER TABLE user_stacks DROP COLUMN IF EXISTS gitea_http_port; ALTER TABLE user_stacks DROP COLUMN IF EXISTS gitea_ssh_port; ALTER TABLE user_stacks DROP COLUMN IF EXISTS gitea_admin_user; ALTER TABLE user_stacks DROP COLUMN IF EXISTS gitea_admin_token; ALTER TABLE user_stacks DROP COLUMN IF EXISTS gitea_memory_repo; -- 2. Add central Gitea repo fields ALTER TABLE user_stacks ADD COLUMN IF NOT EXISTS gitea_repo_name TEXT; ALTER TABLE user_stacks ADD COLUMN IF NOT EXISTS gitea_repo_owner TEXT; -- 3. Add version tracking columns (changes.md ยง9) ALTER TABLE user_stacks ADD COLUMN IF NOT EXISTS image_version TEXT; ALTER TABLE user_stacks ADD COLUMN IF NOT EXISTS migration_version TEXT; ALTER TABLE user_stacks ADD COLUMN IF NOT EXISTS prompt_version TEXT; -- 4. Simplify actors table for unified model ALTER TABLE actors DROP COLUMN IF EXISTS sub_type; ALTER TABLE actors DROP COLUMN IF EXISTS channel_id; ALTER TABLE actors DROP COLUMN IF EXISTS parent_actor_id; -- Change kind enum: was ('grow','sub'), now ('user') -- Note: Drizzle handles enum changes via application-level migration. -- The application code now only uses kind='user'. -- Existing rows with kind='grow' or 'sub' will be left as-is (backward compatible reads).