mirror of
https://github.com/ent/ent.git
synced 2026-05-22 09:31:45 +03:00
* Improve sqlexist template * Address review comment and regenerate files * Regenerate using go1.19 * Run go generate for examples dir * Address review comment * Update entc/gen/template/dialect/sql/query.tmpl Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
Versioned Migration Example
The full reference example for https://entgo.io/docs/versioned-migrations#create-a-migration-files-generator.
Migration directory
Versioned migration files exists under ent/migrate/migrations and follows the golang-migrate format.
Changes to the Ent schema
1. Change the ent/schema.
2. Run go generate ./ent
Generate new versioned migration
go run -mod=mod ent/migrate/main.go <name>
Run linting
go run -mod=mod ariga.io/atlas/cmd/atlas@master migrate lint \
--dev-url="mysql://root:pass@localhost:3306/test" \
--dir="file://ent/migrate/migrations" \
--dir-format="golang-migrate" \
--latest=1