samedi 2 septembre 2017

Laravel 5.4: Artisan Migrate:Rollback Tries to Find Wrong Migration After Git Branch

I'm helping develop a Laravel app, which is versioned in a git repo. I added some new migrations to the branch I was working on, and I can migrate and rollback with them just fine.

Before I checkout another branch, I make sure to rollback the migrations which are specific to the current branch.

I can checkout the other branch, and migrate with the new migrations in this other branch.

user@machine: php artisan migrate
Migrating: 2017_08_29_015050_create_some_table
Migrated:  2017_08_29_015050_create_some_table
Migrating: 2017_08_30_023539_create_some_other_table
Migrated:  2017_08_30_023539_create_some_other_table

At this point all is well and good... Except for when I try to rollback these 2 migrations.

user@machine: php artisan migrate:rollback --step=1
Rolling back: 2017_08_30_023539_create_some_other_table
Rolled back:  2017_08_30_023539_create_some_other_table
user@machine: php artisan migrate:rollback --step=1
Migration not found: 
2017_08_30_003208_migration_from_another_branch

It successfully rolls back the very last migration it ran, but when I try to step back again, it tries to find a migration which doesn't even exist in this branch, and which was rolled back before I even checked out the other branch.

I tried composer dumpautoload but I am still having the exact same problem. Instead of rolling back create_some_table, it tries to roll back migration_from_another_branch.

Things I've tried:

  • composer dumpautoload
  • php artisan cache:clear
  • php artisan config:cache
  • php artisan optimize
  • php artisan clear:compiled

What do I do to fix this, and what should my workflow be to avoid problems like this in the future? Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire