-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add versioned migrations #1313
Add versioned migrations #1313
Conversation
3838aaa
to
3e787a8
Compare
a0315f8
to
61894e7
Compare
178786b
to
465a6ae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you did a great job with this. 🙇
I would love if we could make the migration generation part of the make generate
flow, just for ease of use. I suppose that's not done due to the naming requirement, right?
I would love if @sagikazarmark would also take a look, before merging.
614ffe7
to
720ae16
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job! Would love to have others also taking a look on it, but I am happy with the current solution.
feat: install atlas from dist binary with nix fix: switch from community version of atlas feat: define initial migration chore: make automigrate configurable and add cmd for local refactor: get rid of make commands and use atlas config file refactor: use golang-migrate format chore: add golang migrate to env refactor: write custom migrate util refactor: expose migrate interface feat: add url parser utility fix: enable migrations under custom path fix: dont return error on no new migrations fix: fix lint and test fix: update e2e config feat: support multiple automigrate modes
fix: fix e2e config chore: regenerate init migration and add config test test: add up down up test
fix: update CI fix: fix pg url fix: run go generate
Co-authored-by: Krisztian Gacsal <[email protected]> Signed-off-by: Alex Goth <[email protected]> chore: remove redundancies of rebasing fix: db startup invocation
Co-authored-by: Krisztian Gacsal <[email protected]> Signed-off-by: Alex Goth <[email protected]>
71d57a3
to
46e603d
Compare
Summary
Schema.Migrate
is replaced bytool/migrate
custom utility for running migrations as part of Application Startup. This behavior is configurable viaPostgresConfig.AutoMigrate
field/type.Current Workflow
openmeter/ent
, thenatlas migrate --env local diff <diffName>
creates the new migration filesmigrate -database "postgres://postgres:postgres@localhost:5432/postgres?sslmode=disable&x-migrations-table=schema_om" -path ./tools/migrate/migrations up
Or you can set
postgres.autoMigrate=migration
to run migrations at startupOther useful commands
Added CI & Consistency Cheks
Future Improvements on Current Workflow
x-migrations-table
in the connection string is a burden running manually.tools/migrate
sets it consistently when invoking from code. A possible direction going forward could be to build on that custom tooling for both the local dev scripts as well as CI & Deploy automations (with all the drawbacks of having custom tooling for this)Notes for Reviwers
postgres.autoMigrate
has a default value of ent which is same as the current default. Howeverconfig.example.yaml
promotes using themigration
value