Introduce new option in migrations:create
command to give a name for migrations files
#3987
Replies: 2 comments 3 replies
-
You can configure the pattern ( So what you could do right now is to override the We could have a guide on this for sure, we could add an option to the CLI too, but it feels a bit dangerous, given the default naming strategy wouldn't work with that (as timestamp is at the end). |
Beta Was this translation helpful? Give feedback.
-
It would be very useful to be able to name migrations via a CLI arg! E.g. yarn mikro-orm migration:create --name SamTest would create a file called |
Beta Was this translation helpful? Give feedback.
-
I'd like to add a new option in
migrations:create
command to give the ability to developers to give specific names formigrations
files, I came fromLaravel
andRuby on rails
world and I had the ability to give the migration file a name.Advantages
Better Organization: Naming migration files in a meaningful way helps keep the migrations organized and easy to understand. It also makes it easier to search for a specific migration when needed.
Improved Documentation: When migration files are named in a descriptive way, it becomes easier to understand the changes being made to the database, even if you don't have access to the code. This can help with future maintenance and upgrades.
Easier Debugging: In the event of a problem, being able to easily locate the migration that caused the issue can save time and simplify the debugging process.
I saw @B4nan suggestions that we can update the configuration, but I'm not sure if we can specific name for each file, also will be much easier if we just put the file name when write
migrations:create
commandExamples
orders
so the migration file will be calledtimestamp_create_orders_table
.timestamp_add_rate_column
ortimestamp_update_order_id_column_to_id
.I think this will be helpful, what do you think guys?
Beta Was this translation helpful? Give feedback.
All reactions