Skip to content

feat: make:model --from-table, --version, release pipeline, dialect CI; fix GroupBy injection - #6

Merged
LouisRiverstone merged 7 commits into
mainfrom
feat/from-table-release-ci-security
Nov 17, 2026
Merged

LouisRiverstone merged 7 commits into
mainfrom
feat/from-table-release-ci-security

Conversation

@LouisRiverstone

Copy link
Copy Markdown
Owner

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.GroupBy passed its argument to GORM unquoted, so GroupBy("id; DROP TABLE users; --") executed the DROP. It is now quoted like OrderBy. GroupByRaw(expr) is the explicit way to group by an expression. Code that passed an expression to GroupBy must switch to GroupByRaw.

CLI

  • migro make:model Name --from-table=users builds the struct from a live table (embeds BaseModel/SoftDeleteModel when the table has the standard columns, nullable columns become pointers, gorm tags only where needed).
  • migro --version.

Release

  • GoReleaser config and a release workflow that publishes CLI binaries on v* tags.
  • CHANGELOG.md, SECURITY.md, issue templates, Dependabot.

CI

  • New MariaDB, CockroachDB and SQL Server jobs. They are continue-on-error until each one is confirmed green.
  • govulncheck, a coverage artifact, and -race on the PostgreSQL and MySQL jobs.

Tests and docs

  • Eager loading issues the same number of queries for 3 and 43 rows.
  • 20 identifier-taking methods are checked against injection payloads.
  • Runnable 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=posts against any database.
  • Check the three new dialect jobs in this PR. I could not run them locally (no Docker), so failures there are expected on the first run and are the point of adding them.
  • The health check for SQL Server and the start command for CockroachDB are the likeliest things to need adjusting.

…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
@LouisRiverstone
LouisRiverstone merged commit 667e85a into main Nov 17, 2026
7 checks passed
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