Repository navigation
fix(db): add the missing columns when a migration hits "duplicate column name" - #15236
Merged
diegosouzapw merged 1 commit intoOct 6, 2026
Conversation
maxmad64bis
force-pushed
the
fix/migration-duplicate-column
branch
from
September 30, 2026 20:42
1fa17e4 to
3729b9e
Compare
maxmad64bis
force-pushed
the
fix/migration-duplicate-column
branch
from
October 2, 2026 15:09
b1f6c59 to
7548fff
Compare
…umn name" Squash 3729b9e9bc + b1f6c59ab0 (maintainer fallback kept). Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
maxmad64bis
force-pushed
the
fix/migration-duplicate-column
branch
from
October 4, 2026 15:52
7548fff to
5ddfb89
Compare
diegosouzapw
merged commit Oct 6, 2026
9cff483
into
cheaper-inference:release/v3.8.52
76 of 97 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ADD COLUMNstatements whose column already exists, then records it. This is what fix(migrations): treat duplicate-column ALTER as no-op #1886 asked for (treat a duplicateALTERas a no-op, per statement).Related Issues
Validation
npm run lint— ESLint reports two unused-function errors inmigrationRunner.ts(isSearchRequestTypeMigration,applySearchRequestTypeMigration) that are already on the base and not touched here; nothing new in the changed filesTests Added Or Updated
tests/unit/db-migrationrunner-duplicate-column.test.ts(new, 5 cases): a file whose first column already exists ends with all its columns; theCREATE TABLEandCREATE INDEXaround the duplicate are kept; a second run changes nothing; the helper skips only existing columns, ignores commented-out statements and leaves statements on a table that doesn't exist yet. Four of the five cases fail without the change.tests/unit/db-migrationrunner-duplicate-column-leftovers.test.ts(new, 2 cases, maintainer): a replay that fails on an existing table or index falls back to recording the ledger row only, and a second run applies nothing. Both fail without the change (assertion on the fallback helper).tests/unit/db/migration-071.test.ts,tests/unit/db-server-tool-executions-migration.test.ts,tests/unit/memory-vec-meta.test.ts,tests/unit/db-migration-runner-extra-dirs.test.ts,tests/unit/db-migrationrunner-constants-split.test.ts,tests/unit/migration-135-numbering-collision.test.ts.Coverage Notes
src/lib/db/migrationRunner/schemaState.ts:stripExistingAddColumnsandapplyMigrationSkippingExistingColumnsare covered bydb-migrationrunner-duplicate-column.test.ts(helper cases and the two end-to-end runs).src/lib/db/migrationRunner.ts: the catch branch that now calls the helper is covered by the same test's end-to-end cases; the other paths keep their existing tests.Reviewer Notes
ADD COLUMNchanges behavior: if nothing can be skipped, or the migration doesn't go through the plain-SQL path, the runner still only records the file, as before. If the replay without the existing columns fails for any reason (another duplicate column, aCREATE TABLEorCREATE INDEXthat already exists), it logs a warning and records the file as before instead of stopping startup.isSchemaAlreadyAppliedcases whose only job is ahasColumncheck could probably be simplified later; I left them alone.