Follow-ups: dependency bump, README parity note, CHECK constraint translation - #155
Open
davidpavlovschi wants to merge 3 commits into
Open
Follow-ups: dependency bump, README parity note, CHECK constraint translation#155davidpavlovschi wants to merge 3 commits into
davidpavlovschi wants to merge 3 commits into
Conversation
gorm.io/gorm 1.25.7 to 1.31.2, github.com/glebarez/go-sqlite 1.21.2 to 1.22.0, which pulls modernc.org/sqlite 1.23.1 to 1.28.0. go mod tidy refreshes the indirect set. The go directive stays at 1.18: gorm 1.31.2 declares go 1.18 and go-sqlite 1.22.0 declares go 1.17, so nothing forces a raise. Test counts are unchanged, 15 top-level tests and 70 including subtests, all passing. Refs #152
SQLITE_CONSTRAINT_CHECK (extended code 275) fell through Translate and reached the caller as a raw driver error, so TranslateError users had to string-match "CHECK constraint failed" to detect it. UNIQUE, PRIMARY KEY and FOREIGN KEY were already mapped. The test drives a real in-memory database: it migrates a model carrying a CHECK constraint, asserts the constraint is in the table DDL so a wrong failure cannot pass for the right one, then inserts a row that violates it. Without the mapping the test fails with the raw error, code 275. This mirrors the backport of the go-gorm#247 follow-up. Refs #152
Collaborator
Author
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.
This is the follow-up batch I promised in #152 and #153, on top of the parity port. Three
independent commits, each reviewable on its own.
Dependencies. gorm.io/gorm 1.25.7 to 1.31.2 and github.com/glebarez/go-sqlite 1.21.2 to
1.22.0, which moves modernc.org/sqlite 1.23.1 to 1.28.0.
go mod tidyrefreshes the indirectset. The
godirective stays at 1.18: gorm 1.31.2 declares go 1.18 and go-sqlite 1.22.0 declaresgo 1.17, so nothing forces a raise and the driver keeps its wide support floor. No test outcome
changed across the bump.
README. A short "Upstream parity" section recording the last upstream commit merged here
(525c431), the three divergences that are deliberate and will stay (pure-Go backend imports,
DriverNamedefaulting tosqlite, andTranslatereading the extended result code off thedriver error instead of marshalling to JSON), and the rule I committed to in #152: anything that
does not depend on the backend goes to go-gorm/sqlite first and comes back here as a port. The
first one is go-gorm#247.
CHECK constraints.
SQLITE_CONSTRAINT_CHECK, extended code 275, fell throughTranslateand reached the caller as a raw driver error, so anyone running with
TranslateError: truehadto string-match "CHECK constraint failed" to detect it. UNIQUE, PRIMARY KEY and FOREIGN KEY were
already mapped, so this closes the gap against
gorm.ErrCheckConstraintViolated. This mirrorsthe follow-up to go-gorm#247.
The test runs against a real in-memory database: it migrates a model carrying a CHECK
constraint, asserts the constraint actually landed in the table DDL so a failure for the wrong
reason cannot pass, then inserts a violating row. With the mapping reverted it fails with the
raw error and code 275.
go test ./...goes from 15 tests to 16, 70 to 71 counting subtests, no failures.gofmt,go vet ./...andCGO_ENABLED=0 go build ./...are clean.Risks
embedded SQLite engine, five minor versions, and it also raises the embedded SQLite library
version, which the README's version badge reports. The fork's own 16 tests pass, but they do
not exercise the engine the way the CI job does. The gate is the GORM 12k-test suite in CI,
which cannot run locally here. Do not merge on local green alone.
parity/upstream-2026-07, so ithas to land after Port 11 behaviour fixes from go-gorm/sqlite (parity with upstream) #153. Rebase onto master once Port 11 behaviour fixes from go-gorm/sqlite (parity with upstream) #153 merges on Aug 3. ci: test against Go 1.24-1.26, matching upstream #154 raises the CI matrix
to Go 1.24 through 1.26; a
go 1.18directive still builds under those, so no conflict, butthe two PRs touch CI expectations from opposite sides.
1.29.6) and build(deps): bump github.com/glebarez/go-sqlite from 1.21.2 to 1.22.0 #115 (go-sqlite to 1.22.0) are all superseded or overshot by this bump. build(deps): bump modernc.org/sqlite from 1.23.1 to 1.29.6 #131 in
particular wants modernc.org/sqlite 1.29.6, which is ahead of the 1.28.0 that go-sqlite 1.22.0
pins. Close them with a pointer to this PR rather than merging in either order.
TranslateError: truewho today catches the raw driver error, or string-matches the message, now receivesgorm.ErrCheckConstraintViolatedinstead. It is the correct behaviour and it matches the otherthree constraint kinds, but it is not strictly backward compatible and belongs in release notes.
and nothing enforces that. It needs updating on every future parity port.