Repository navigation
feat: make:model --from-table, --version, release pipeline, dialect CI; fix GroupBy injection - #6
Merged
Conversation
…I; fix GroupBy injection Security fix (breaking): Query.GroupBy passed its argument to GORM unquoted, so a caller-supplied value could inject SQL. It is now quoted like OrderBy. Use the new GroupByRaw to group by an expression. - make:model --from-table generates a model from a live table - migro --version (ldflags via goreleaser, build-info fallback) - GoReleaser + release workflow, CHANGELOG, Dependabot, SECURITY.md, issue templates - CI: MariaDB, CockroachDB and SQL Server jobs (non-blocking), govulncheck, coverage, -race on PG/MySQL - Tests: eager-loading query count is constant, identifier arguments stay quoted - Example tests, coming-from-GORM and coming-from-Laravel pages, per-dialect feature table
…t Go - CockroachDB: identity columns instead of SERIAL (sequential ids), DROP INDEX ... CASCADE for unique constraints - SQL Server: RESTRICT becomes NO ACTION; aggregates no longer add an ORDER BY via LIMIT - Tests tolerate UNSUPPORTED_FEATURE for row locks and InsertOrIgnore; the injection test understands [bracket] quoting - CI: SQL Server tests run in their own database; govulncheck uses the latest Go; golang.org/x/text v0.41.0
- Min/Max return int64 for every integer width, so the result type no longer depends on the driver - SQL Server: AVG over an integer column is cast to float; a cascading self-referencing foreign key is refused with a clear error - Tests: ToSQL accepts FETCH NEXT, the self-referencing cascade check skips SQL Server, the fixture picks NO ACTION there
…ne tests portable - DropColumn on SQL Server removes the auto-named DEFAULT constraint before the column - Tests bind booleans instead of the TRUE literal and expect NO ACTION for the self-referencing key on SQL Server
…rtable insert in the pipeline test
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.
Why
Follow-up to the improvement review: close the release loop, verify more dialects in CI, and fix what the new safety tests found.
What changed
Security fix (breaking).
Query.GroupBypassed its argument to GORM unquoted, soGroupBy("id; DROP TABLE users; --")executed theDROP. It is now quoted likeOrderBy.GroupByRaw(expr)is the explicit way to group by an expression. Code that passed an expression toGroupBymust switch toGroupByRaw.CLI
migro make:model Name --from-table=usersbuilds the struct from a live table (embedsBaseModel/SoftDeleteModelwhen the table has the standard columns, nullable columns become pointers,gormtags only where needed).migro --version.Release
releaseworkflow that publishes CLI binaries onv*tags.CHANGELOG.md,SECURITY.md, issue templates, Dependabot.CI
continue-on-erroruntil each one is confirmed green.govulncheck, a coverage artifact, and-raceon the PostgreSQL and MySQL jobs.Tests and docs
Example*tests, "Coming from GORM" and "Coming from Laravel/Lucid" pages, a per-dialect feature table, and a corrected "what is verified" table.How to verify
go test -race ./...passes locally on SQLite (321 tests).migro make:model Post --from-table=postsagainst any database.