Answer the question
In order to leave comments, you need to log in
Are there any recommendations for naming DB migrations?
Somehow I didn’t think much about this. there have always been migrations with a timestamp, which nullified collisions of migration class names, in the lara I saw what migration classes are called without a timestamp (just CreateArticlesTable), to which I thought that if the project is old in which they could change their mind a bunch of times and do the same actions, then they could be class name conflicts. Maybe magic somehow solve this issue, but still.
So far, in addition to the Lara docks, I found only here https://github.com/alexeymezenin/laravel-best-practices recommend using "2017_01_01_000000_create_articles_table" instead of "2017_01_01_000000_articles"
Good.
1. I roughly guess how to delete a table, delete and add one or two fields, and if the table changes a lot? ModifyArticleTableScheme? ModifyArticleTableSchemeVer2020?
2. If I need to not only change most of the table but also add a new table that has foreign keys with the first table? adding new table - separate migration?
In general, I want to hear what you call database migrations
Answer the question
In order to leave comments, you need to log in
It doesn't matter, to be honest. It will start once and then you can forget about it forever.
Conflicts are unlikely, never joined.
AddTargetTypeColumnToOptionsTable
AddSomeSetOfFieldsToSomeTable
MakeOptionFieldsNullable
CreateSomeTable
RenameSomeFieldInSomeTable
RenamePackageTables
The main thing is that it would be convenient for you to look for it before it is comical. The rest doesn't matter.
I name the elements of the corresponding SQL query, for example
'alter_users_add_rating'
But if we talk about name conflicts, in my opinion, the timestamp is sufficient so that the conflict does not occur.
Use the onecentlin.laravel-extension-pack plugin (or rather, ryannaddy.laravel-artisan as part of this pack) for vs code, using the Artisan: make migration command, it will substitute the current utc time at the beginning of the file name. And the rest can be finished with a couple of words to describe what is changing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question