In Yii2, when I use the
yii migrate
command, I get a long list of remaining migrations. How can I only run one specific migration in the list without performing the others?
Run migrate/history
to list migrations have been applied:
./yii migrate/history
Copy the name of migration you want to return to later (lets say it is 'm160101_185401_initial_migration'). Save it somewhere because you're going to need this later.
Mark migration history at the one just before the one you need to run:
./yii migrate/mark m170101_185401_create_news_table
Run one migration:
./yii migrate 1
Reset migration history:
./yii migrate/mark m160101_185401_initial_migration
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