-
-
Notifications
You must be signed in to change notification settings - Fork 144
refactor(database)!: improve make:migration experience
#1935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
make:migration experience
make:migration experiencemake:migration experience
brendt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad on not merging this before tagging 3.0, because the MigrationPrefixStrategy rename is a breaking change.
Not too big a deal though, but maybe we should just revert it back to the original name?
Then we could rename it as part of 4.0
Yeah, I can do that. I'll push a commit in a few minutes. |
|
There it is. |
The followings are now possible:
The table name and alter are also predicted (as mentioned above).
For the
$alterfeature, the guesser is expecting acreatekeyword as the first word, if that appears, it will predicttrue, acreatemigration. If not, then we are looking for prepositions (_to_,_from_,_in_), if any of those exist, we predictfalse, analtermigration. If none of those exists, we fall back totrue, acreatemigration.For the table name prediction, the guesser follows the same rules: if the migration starts with a
createkeyword, we stripcreate_and the optional_tablesuffix, and use what remains as the table name (in this case:books). If not, then we are looking for prepositions (_to_,_from_,_in_), and if any of those exist, we take everything after the last preposition, strip the optional_tablesuffix, and use that as the table name. If none of those exists, we fall back to using the full migration name as the table name candidate, and then normalize it to get the final table name.The command also takes
NamingStrategyandMigrationNamingStrategyinto account when creating the final table name.