Repository navigation
fix(migrations): preserve only reserved sqlite_ objects during reset … - #651
Merged
leo-aa88 merged 1 commit intoNov 5, 2026
Merged
Conversation
…ombit-dev#491) SQLite LIKE treats '_' as a one-character wildcard. Escape it when filtering sqlite_master so user tables and views such as sqlitex_cache or sqlite3_import are dropped, while SQLite's reserved sqlite_ objects stay untouched. Add a CGO-backed native SQLite regression covering mixed-case names, views, and sqlite_sequence preservation. Refs: gombit-dev#491
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
Fixes #491.
SQLite
LIKEtreats_as a single-character wildcard. The existingNOT LIKE 'sqlite_%'filter incorrectly preserves user tables such assqlitex_cacheandsqlite3_import, causing subsequentdb resetmigration runs to fail.Escape the underscore so only SQLite's reserved
sqlite_prefix is preserved. Add a native SQLite regression test covering user tables, mixed-case names, views, andsqlite_sequence.Acceptance criteria
The issue does not specify a formal acceptance checklist; these criteria follow its reported behavior and expected outcome.
sqlitebut not the reservedsqlite_prefix.sqlite_sequence.Scope notes
Only
migrations/reset.goand the new regression test are changed. No API, generator, or authentication changes.Validation
Passed locally — Linux/amd64, Go 1.26.9, CGO enabled:
go test ./migrations -run TestDropSQLiteSchemaOnlyPreservesReservedPrefix -count=1go test ./migrations ./database ./config -count=1go build -p 4 ./...go vet ./migrations ./database ./configgolangci-lint v2.12.2 run ./migrations ./database ./config— 0 issuesNot fully verified:
go test ./...— attempted; failed or timed out in unrelated CLI/client tests because WSL invoked Windowsnpx, producing filesystem path errors. The same failure was reproduced against unchanged upstream code.code-reviewskill — not run.Working agreement checklist
Documentation, generators, frontend assets and API-contract regeneration are outside the scope of this focused bug fix.