Repository navigation
Conversation
There was a problem hiding this comment.
The fix works. On the base, I built a database whose blob table has the old (id, data) layout, as described in the issue, and opencode serve failed at 20261025123711_blob with table `blob` already exists. With this PR, the same database migrates and the server starts. blob has the new layout, blob_ref is created, and the old row is kept in blob_v1_legacy. The new test passes here and fails on the base. tsc -b for packages/core passes.
The check before the rename works the same way as the existing PRAGMA table_info guards in the session-metadata and workspace-name migrations, and nothing reads the renamed table. #64203 already fixed the desktop half of #63913, so with this change the whole issue is covered.
Public API: unchanged.
No blocking concerns.
Issue for this PR
Closes #63913
Type of change
What does this PR do?
20261025123711_blobdoes a bareCREATE TABLE blob (...)for the content-addressed table. A database that went through the V1→V2 migration can already hold the legacyblob(id, data)table (the desktop drafts migration creates it in the same file), so the migration dies withtable blob already existsand the rest of the upgrade, includingopencode serve --service, never completes.Before creating the new table, the migration now renames a
blobtable that has nohashcolumn toblob_v1_legacy. Nothing references that table, and whatever rows it holds survive the rename. Ablobtable that already has the new shape is left alone and still fails loudly, so a half-applied schema is never silently replaced.The desktop drafts half of the report (
20260906234153_draftscolliding withdocument) is a separate migration inpackages/desktopand is not changed here.How did you verify your code works?
packages/core/test/database-migration.test.tsseeds the legacyblob(id, data)table with a row and applies the migration: the resultingblobhashash, andblob_v1_legacystill holds the row.bun test test/database-migration.test.tsinpackages/core: 25 pass.20261025123711_blobplusblobandblob_ref, restored ablob(id, data)row, then ranDatabaseMigration.apply. On the base it fails at20261025123711_blob; with this change it completes,blobhas the new shape, and the legacy row is inblob_v1_legacy.bun typecheckinpackages/core: no type errors.Visual
Not a UI change.
Screenshots / recordings
Not applicable.
Checklist