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
I am new to database migrations with Golang. I am trying out golang-migrate with pgx/v5. After having installed migrate I ran following commands from the terminal on a MAC.
Error I get is 2024/05/05 17:21:27 error: duplicate migration file: 000001_create_user_table.down.sql
Both sets of .go and .sql files get created with 000001_ prefix.
Is it even legal to mix go and sql migrations? If yes, what's the best way to handle this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am new to database migrations with Golang. I am trying out golang-migrate with pgx/v5. After having installed migrate I ran following commands from the terminal on a MAC.
mkdir migrations
migrate create -ext sql -dir ./migrations/ -seq create_user_table
/tmp/migrations/000001_create_user_table.up.sql
/tmp/migrations/000001_create_user_table.down.sql
migrate create -ext go -dir ./migrations/ -seq add_seed_data
/tmp/migrations/000001_add_seed_data.up.go
/tmp/migrations/000001_add_seed_data.down.go
migrate -path ./migrations/ -database "pgx5://postgres:some_password@localhost:5432/example?sslmode=disable" -verbose up
Error I get is
2024/05/05 17:21:27 error: duplicate migration file: 000001_create_user_table.down.sql
Both sets of .go and .sql files get created with 000001_ prefix.
Is it even legal to mix go and sql migrations? If yes, what's the best way to handle this?
regards, Yogi
Beta Was this translation helpful? Give feedback.
All reactions