Rollback one specific migration in Laravel

前端 未结 19 1479
梦毁少年i
梦毁少年i 2020-12-02 04:14

I want

to rollback only :

Rolled back: 2015_05_15_195423_alter_table_web_directories


I run

php artisan migrate:roll

相关标签:
19条回答
  • 2020-12-02 05:07

    Best way is to create a new migration and make required changes in that.

    Worst case workaround (if you have access to DB plus you are okay with a RESET of that table's data):

    1. Go to DB and delete/rename the migration entry for your-specific-migration
    2. Drop the table created by your-specific-migration
    3. Run php artisan migrate --path=/database/migrations/your-specific-migration.php

    This will force laravel to run that specific migration as no entry about it exists in Laravel's migration history

    UPDATE: The Laravel way (Thanks, @thiago-valente)

    Run:

    php artisan migrate:rollback --path=/database/migrations/your-specific-migration.php

    and then:

    php artisan migrate

    This will re-run that particular migration

    0 讨论(0)
提交回复
热议问题