Skip to content

migrate-dev-db fails during prune: FOREIGN KEY constraint failed #104

Closed

Description

@pechhe

`node apps/server/scripts/migrate-dev-db.ts --base-dir /.t3` (and `vp run migrate-dev-db` in a SlipJay workspace) fails against the current live `statev2.sqlite`:

```
Pruning to 5 projects, 10 stopped threads each...
MigrateDevDbPhaseError: migrate-dev-db failed during prune ...
FOREIGN KEY constraint failed
```

The prune transaction (`apps/server/scripts/migrate-dev-db.ts`, around the `DELETE FROM projection_projects` / per-`thread_id` table deletes) leaves a row that still references a deleted project or thread, probably one in a table that has neither a `thread_id` column nor an entry in `CLEARED_TABLES`. Find the table with `PRAGMA foreign_key_check` on the pruned snapshot and prune or clear it there.

Two other problems: `vp run migrate-dev-db` also refuses to run in SlipJay workspaces ("Not inside a linked git worktree"), because they are jj-only, so `--base-dir` is needed. And there is no seeded test data for UI checks until this is fixed.

Activity

  1. pechhe commented on Oct 17, 2026

    @pechhe
    OwnerAuthor

    Fixed with #49 in t3peach a176d5c; migrate-dev-db now completes against the live database. The jj-workspace refusal stays with #66: in a SlipJay workspace, dev tooling also falls back to the shared home (vp run dev used ~/.t3/dev without --home-dir), so pass --home-dir / --base-dir until #66 lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions