chore(database): drop the dead tables and columns (cleanup round 2, 2/2)
Merged
DA
6d ago+3951+3951+0123456789012345678901234567890123456789-186-186-012345678901234567890123456789
Summary
Cleanup round 2, step 2, PR 2 of 2 (Dean approved: do #2). The contract half: the migration that drops what #2351 stopped declaring.
#2351 is live in production:
- It merged as
651e41e1at 12:32Z. - Production recorded its migration
20261013120444_dead_tables_pending_dropineffect_sql_migrationsat 12:32:28Z. - GitHub's Production deployment for
651e41e1reported Vercel "Deployment has completed" at 12:35:39Z. - This PR merges no earlier than an hour after that, the README's go-live window.
20261013123642_dead_tables_drop (custom, every statement IF EXISTS) drops:
- tables:
events,provider_cursors,provider_key,roster_snapshot,transcript_mark,observation_pass,workspace_file,workspace_embedding,devices,account_workspace_preference,introduction_usage - columns:
account_preference.default_workspace_provider, plus onconversations:provider_id,provider_session_id,workspacespawned_by_message_id,completion_delivered_atnext_event_seqmemory_flush_operation_id,memory_flush_outcome,memory_flushed_at
- indexes:
conversations_observed_sessionandconversations_undelivered_children drizzleschema: it holds only the old runner'sdrizzle.__drizzle_migrations, its sequence, and its types, soDROP SCHEMA IF EXISTS "drizzle" CASCADEremoves exactly that.
provider_key is NOT the BYOK table. BYOK keys are account_provider_key (migration 0080_account_provider_key), which this PR leaves alone. provider_key is the earlier vault table, which no module has declared since #2351.
Kept, because they're live: a child conversation's parent_conversation_id, label, title, expects_completion.
Safety
- Snapshot: Neon snapshot
pre-dead-tables-drop-2026-10-13(snap-still-meadow-au04oyvh) taken ofproductionat 12:37:54Z. On top of that, the project keeps 24h of point-in-time restore (history_retention_seconds: 86400). - Re-verified against the live release
651e41e1: no source underpackages/orapps/web/{server,eve,coder}names a dropped table or column. Two hits aren't the database:packages/guide's desktop-localdefault_workspace_providersetting key, and a coding agent'sprovider_keyfailure code.pg_stat_user_tablesshows the dead tables' latest index scans fit foreign-key cascades, not reads: for exampleevents, last read 2026-10-12T17:32, when deleting messages cascades into it. - No live table has a foreign key into a dropped table; the only foreign key on a dropped column is
conversations.spawned_by_message_id ā messages, which goes with it.
Rows dropped in production:
| Table | Rows |
|---|---|
events | 2155 |
provider_cursors | 403 |
provider_key | 9 |
roster_snapshot | 3 |
transcript_mark | 3 |
observation_pass | 3 |
workspace_file | 65 |
workspace_embedding | 380 |
devices | 22 |
account_workspace_preference | 3 |
introduction_usage | 31 |
drizzle.__drizzle_migrations | 22 |
| Total | 3099 |
Column values dropped:
default_workspace_provider: 3 non-null.- On the 969 observed conversations (the rows themselves stay): 969
provider_idand 969provider_session_idvalues, and 479workspacevalues. spawned_by_message_idandcompletion_delivered_at: 0 non-null.
Tests
storage-schema.test.ts's declared-tables list loses the eleven, and the drift check'sPENDING_DROP/PENDING_DROP_TABLESentries go, so both fail if the migration doesn't drop them.dead-tables-dropped.test.tsfrom #2351 goes. Every store suite now runs over the dropped shape.store-writer-boundary.test.tsstops guardingevents(its fixtures move tomessages/turns).- This PR's Vercel Preview branches its Neon database from production and runs this migration through the real migrator: a rehearsal on production's data.
Evidence
- Platform-independent checks:
./scripts/check.shexit 0 locally (knip, lint, discarded-effect, typecheck, test all passed) - macOS Electron verification (
./scripts/verify.sh):not run. No Mac or UI change, and this is a Linux VM; CI cannot verify the Mac (LUKE-159 is the manual Mac pass)
Invariants
-
./scripts/check.shgreen. No renderer/UI change. - JSON Schema goldens unchanged.
- The schema tests that fail without the drop are in this PR; no change-detector test added.
- Gateway envelope goldens unchanged.
- No new
astype assertion. - No
Effect.runPromise/runSync/runForkadded. - No raw async primitive added.
- No discarded Effect.
- Test count: ā1 file (
dead-tables-dropped.test.ts), as above. - No hand-rolled file replaced.
-
apps/web/server/README.mdupdated; rootAGENTS.md/CLAUDE.mduntouched. -
PRIVACY.mdunchanged. - Package deps unchanged.
- Barrel/door rule untouched.
Notes
- Restore path if needed: Neon snapshot
snap-still-meadow-au04oyvh, or point-in-time restore ofproductionto before this migration's timestamp ineffect_sql_migrations.
š¤ Generated with Claude Code