Reputation: 1190
I want to create migrations that are date based 20241010173522, not sequential 001, 002, etc.
I see the cli command option -format
I'm expecting that you can do -format datetime or something similar.
When I run the below command, I get a file named datetime_initial_blank
I'm expecting 20241010173522_inital_blank
migrate create -ext sql -dir db/migrations -format datetime initial_blank
Is the only way with something manual like generating the datetime on my own and prefixing the file name, or can golang-migrate handle this on its own?
Upvotes: 0
Views: 76
Reputation: 1190
The format flag expects a golang time format.
For example
migrate create -ext sql -dir db/migrations -format 20060102150405 initial_blank
creates migration files
...\db\migrations\20241014135924_initial_blank.up.sql
...\db\migrations\20241014135924_initial_blank.down.sql
These are in UTC time.
Upvotes: 0