-
Notifications
You must be signed in to change notification settings - Fork 1.5k
-
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.