dousi6087 2016-01-31 15:26 采纳率: 100%
浏览 202
已采纳

Laravel 5 - 跳过迁移

I have migrated an existing Laravel 5 application and database. Only no migrations table was there yet, so I created this with the following command:

php artisan migrate:install

Inside the database migration folders three files exist (2015_12_08_134409_create_tables_script.php, 2015_12_08_134410_create_foreign.php, 2015_12_08_134411_create_index.php)

When using 'php artisan migrate' the scripts inside the migrations folder are executed again. This is what I want to avoid. Is it possible to insert records in Laravel's migrations table, so these scripts will be skipped and new scripts will be picked up once 'php artisan migrate' is executed again?

  • 写回答

2条回答 默认 最新

  • dreinuqm992401 2016-01-31 16:52
    关注

    Once you have the migration table created, insert these records:

    insert into migrations(migration, batch) values('2015_12_08_134409_create_tables_script',1);
    insert into migrations(migration, batch) values('2015_12_08_134410_create_foreign',1);
    insert into migrations(migration, batch) values('2015_12_08_134411_create_index',1);
    

    So artisan will understand those migrations as 'executed'

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?