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
Run the migrate create cli command with the option to generate sequential up/down migrations with N digits: migrate create -dir ./migrations -seq -digits 2 -ext sql foobar
I think this happens because not all file have the same amount of digits, but this still works when applying migrations so I think it should be fixed. Also suffering the same here!
First of all thanks for making this great library <3.
Describe the Bug
The
create
cli command produces the wrong migration number.Command used:
The
/migrations
folder contains the following files:Steps to Reproduce
Steps to reproduce the behavior:
/migrations
folder somewhat like the following:migrate create -dir ./migrations -seq -digits 2 -ext sql foobar
~/go/src/migratetest migrate create -dir ./migrations -seq -digits 2 -ext sql foobar error: duplicate migration version: 10
Expected Behavior
The migrate create cli command does not raise an error, instead it creates the files
12_foobar.up.sql
and12_foobar.down.sql
.Migrate Version
v4.17.1
Loaded Source Drivers
(Should not matter)
Loaded Database Drivers
(Should not matter)
Go Version
go version go1.22.2 darwin/arm64
Stacktrace
Additional context
The
matches
obtained in the create cli Command in line 87:migrate/internal/cli/commands.go
Line 87 in 2477f63
results in the slice:
When
nextSeqVersion
is used to obtain the next version number it takes the last element of the slice in line 31:migrate/internal/cli/commands.go
Line 31 in 2477f63
and this results in the new version number being determined as
10
, which in this case is not correct.The text was updated successfully, but these errors were encountered: