mattes / migrate

Database migrations. CLI and Golang library.
Other
2.29k stars 326 forks source link

add option to choose a timestamp format for migration files in CLI #329

Open alex-bogomolov opened 6 years ago

alex-bogomolov commented 6 years ago

Currently the Unix timestamp is the only option while generating migration files. This PR adds an option to choose a datetime format for the migration timestamp.

I have added the -timestamp option for create action:

migrate create -timestamp time migration_name

For example, for Jan 18th 2018, 18:19:03 the datetime migration timestamp will be 180117181903, while the standard Unix timestamp will be 1516205943.

In some cases, datetime timestamps are more convenient to work with. If -timestamp flag is not supplied, the default Unix timestamp will be used.