Laravel 5-跳过迁移 [英] Laravel 5 - skip migrations
问题描述
我已经迁移了现有的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
在数据库迁移文件夹中,存在三个文件(2015_12_08_134409_create_tables_script.php,2015_12_08_134410_create_foreign.php,2015_12_08_134411_create_index.php)
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)
使用"php artisan migration"时,将再次执行migrations文件夹中的脚本.这就是我要避免的.是否可以在Laravel的迁移表中插入记录,因此一旦再次执行"php artisan migration",这些脚本将被跳过,而新脚本将被提取?
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?
推荐答案
创建迁移表后,插入以下记录:
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'
这篇关于Laravel 5-跳过迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!