Its possible to change a name o file create by migration? like this `18b6422c9d3f i prefer organize usign date-time like 201705121927
its possible change configs of alembic to do that?
Yes, you can name them however you want, but they will run in alphabetical order (which is why laravel timestamps them). Also you can change a migrations name after the fact (you've already run the migration).
You can change the migration file name, but you have to perform a few steps: rake db:rollback to the point that queries table is rolled back. Now change the name of migration file, also the contents. Change the name of any Model that may use the table.
Migration File NamesEach Migration is run in numeric order forward or backwards depending on the method taken. Each migration is numbered using the timestamp when the migration was created, in YYYY-MM-DD-HHIISS format (e.g., 2012-10-31-100537). This helps prevent numbering conflicts when working in a team environment.
You need to edit alembic.ini
.
Parameter that you looking for is file_template
.
From docs:
file_template
- this is the naming scheme used to generate new migration files. The value present is the default, so is commented out. Tokens available include:
%%(rev)s
- revision id%%(slug)s
- a truncated string derived from the revision message%%(year)d, %%(month).2d, %%(day).2d, %%(hour).2d, %%(minute).2d, %%(second).2d
- components of the create date, by defaultdatetime.datetime.now()
unless thetimezone
configuration option is also used.
By default it is set to %%(rev)s_%%(slug)s
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With