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
Correct order of migrations for golang migrate is not lexicographic, it is supposed to be numeric, with number extracted from file name before underline _.
Unfortunately command atlas migrate hash does not seem to take that into account correctly and starting from migration 10 two things starts to happen:
migration 10_whatever.up.sql would appear in the atlas.sum before 1_whatever.up.sql
all hashes for files with versions 1-9 would be recalculated again even though files did not change
Then when migration 11 would appear, it would be after 10, but before 1, while still recalculating hashes 1-9, but NOT recalculating hash for 10 (it appears that hash somehow includes all previous versions, with definition of previous being wrong).
, so altas should be aware of golang-migrate specifics.
I see in that doc that numbers for generated files are timestamps (which is not correct from golang-migrate perspective actually, as they are commonly versions), that would be fine with lexicographic sorting, but I usually rename whatever came out of atlas diff and until version 10 it was not the issue.
I believe that configuring format = "golang-migrate" , should make atlas to start sorting migrations correctly according to what golang migrate says about ordering of migrations.
The text was updated successfully, but these errors were encountered:
Correct order of migrations for golang migrate is not lexicographic, it is supposed to be numeric, with number extracted from file name before underline
_
.Unfortunately command
atlas migrate hash
does not seem to take that into account correctly and starting from migration 10 two things starts to happen:Then when migration 11 would appear, it would be after 10, but before 1, while still recalculating hashes 1-9, but NOT recalculating hash for 10 (it appears that hash somehow includes all previous versions, with definition of previous being wrong).
Note, I did configure atlas.hcl like so:
(as explained in documentation https://atlasgo.io/guides/migration-tools/golang-migrate )
, so altas should be aware of golang-migrate specifics.
I see in that doc that numbers for generated files are timestamps (which is not correct from golang-migrate perspective actually, as they are commonly versions), that would be fine with lexicographic sorting, but I usually rename whatever came out of
atlas diff
and until version 10 it was not the issue.I believe that configuring
format = "golang-migrate"
, should make atlas to start sorting migrations correctly according to what golang migrate says about ordering of migrations.The text was updated successfully, but these errors were encountered: