Skip to content

Port 11 behaviour fixes from go-gorm/sqlite (parity with upstream) - #153

Open
davidpavlovschi wants to merge 1 commit into
masterfrom
parity/upstream-2026-07
Open

Port 11 behaviour fixes from go-gorm/sqlite (parity with upstream)#153
davidpavlovschi wants to merge 1 commit into
masterfrom
parity/upstream-2026-07

Conversation

@davidpavlovschi

Copy link
Copy Markdown
Collaborator

Delivers the parity plan from #152. Every behaviour-changing upstream commit since 7544227 (2024-03-09) is ported and verified against the modernc backend — the full table with per-fix symptoms is in the audit comment.

What's deliberately kept divergent (and why): the glebarez/go-sqlite + modernc imports, DriverName = "sqlite", and this fork's Translate — ours type-switches on real sqlite error codes instead of upstream's JSON round-trip, which is the better implementation.

Verification: migrator.go, ddlmod.go, ddlmod_parse_all_columns.go are upstream-verbatim (no driver references exist in them); sqlite.go is hand-merged (~65 lines). Upstream's test files for these paths (ddlmod_test.go, ddlmod_parse_all_columns_test.go, migrator_test.go, generated_test.go) are ported unchanged and pass: 70 tests run, all green, both on the current pinned deps (gorm 1.25.7 / modernc.org/sqlite 1.23.1) and on bumped ones (gorm 1.31.2 / modernc.org/sqlite 1.55.0). gofmt clean.

Not in this PR (follow-ups, per the plan in #152): go.mod dependency bumps, CI matrix bump to Go 1.24–1.26, README parity note.

Refs #152

Ports every behaviour-changing upstream commit since 7544227, verified
against the modernc backend:

- 13be5e3 (go-gorm#236): preserve indexes, triggers, table options and views
  across table rebuilds
- d450667 (go-gorm#235): HasColumn matches exactly via pragma_table_info
- 69c4707 (go-gorm#230): generated (computed) columns via the generated tag
- fc0cfd3 (go-gorm#207): parse CHECK/CONSTRAINT/FOREIGN KEY table-level lines
- 5406e41 (go-gorm#198): case/whitespace-tolerant constraint matching
- 02b8e06 (go-gorm#193): parseAllColumns state machine for composite keys
- 7230345 (go-gorm#229): disable foreign keys during DropColumn
- 6f07b51: don't overwrite caller-registered clause builders
- 75dbf08 (go-gorm#222): accept tab between column name and type
- bbca3b3 (go-gorm#185): exported Config and New(Config) constructor
- 5df1f76 (go-gorm#219): remove stray Debug() from GetIndexes

migrator.go, ddlmod.go and ddlmod_parse_all_columns.go are taken from
upstream verbatim; sqlite.go is hand-merged to keep this fork's imports,
DriverName, and its error-code-based Translate. Upstream's test files
for these paths are ported unchanged.

Refs #152
@davidpavlovschi

Copy link
Copy Markdown
Collaborator Author

Note on the red CI: every ubuntu lane passes (1.19/1.20/1.21). The failures are environmental — Go ≤1.21 binaries abort with missing LC_UUID on current macos-latest runners, and the GORM-tests lane dies parsing gorm master's go 1.24.0 directive before any test runs. #154 bumps the matrix to 1.24–1.26 (upstream's own); I'll rebase this branch once that lands.

@davidpavlovschi

Copy link
Copy Markdown
Collaborator Author

@glebarez plan: I'll leave this and #154 open for review until Aug 3. If you have no objections by then I'll merge both and tag a release so the fixes actually reach users. Shout if you want anything changed or want to review first.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant