You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The other day our team was applying migrations for the first time to an existing database. We ran migrate apply --dry-run --baseline <version> to see what would be run. The expectation was that no changes would be made to the database. However, it seems like the --dry-run argument has no effect when --baseline is present: the atlas_schema_migrations table was created and that version was marked as completed.
As this didn't actually touch our data this was not a major deal, but with some nervous people on the call, you can understand that unexpected behavior like this the first time we ran against our staging database didn't put them at ease 😆 . Hopefully you agree that this behavior is worth changing and hopefully it's easy to do so.
Expected behavior: when --dry-run is included, no changes are made to the database.
Observed behavior: when --baseline and --dry-run appear together, changes are made to the database. Example:
Reproducer
Commands run were:
docker compose up -d
atlas migrate status --env local
atlas migrate apply --env local --dry-run --baseline 20241213151219
atlas migrate status --env local
What happened here is that the baseline was marked in the database, but no migrations were applied to it (it's only stored in Atlas' revisions table). This happened because baseline resolving/marking runs in a different stage, before migrations are executed.
I think we should change --dry-run to include baseline as well. We'll handle this soon.
Hello atlas team!
The other day our team was applying migrations for the first time to an existing database. We ran
migrate apply --dry-run --baseline <version>
to see what would be run. The expectation was that no changes would be made to the database. However, it seems like the--dry-run
argument has no effect when--baseline
is present: theatlas_schema_migrations
table was created and that version was marked as completed.As this didn't actually touch our data this was not a major deal, but with some nervous people on the call, you can understand that unexpected behavior like this the first time we ran against our staging database didn't put them at ease 😆 . Hopefully you agree that this behavior is worth changing and hopefully it's easy to do so.
Expected behavior: when
--dry-run
is included, no changes are made to the database.Observed behavior: when
--baseline
and--dry-run
appear together, changes are made to the database. Example:Reproducer
Commands run were:
Here's a zip:
baseline-bug.zip
But here I'll reproduce those files so readers don't have to download the zip if they don't want to.
atlas.hcl
docker-compose.yml
schema.sql
migrations/20241213150809_table1.sql
migrations/20241213151219_table2.sql
migrations/20241213151310_table3.sql
migrations/atlas.sum
The text was updated successfully, but these errors were encountered: