我想要的

仅回退:

回滚:2015_05_15_195423_alter_table_web_directories


我跑

PHP artisan migrate:rollback,我的3个迁移都在回滚。

Rolled back: 2015_05_15_195423_alter_table_web_directories
Rolled back: 2015_05_13_135240_create_web_directories_table
Rolled back: 2015_05_13_134411_create_contacts_table

我删除

我的web_directory和我的联系人表都是无意的。我不希望发生这种情况,如果我只能回滚特定的一个,这种灾难就永远不会发生。


当前回答

INSERT INTO homestead.bb_migrations (`migration`, `batch`)  VALUES ('2016_01_21_064436_create_victory_point_balance_table', '2')

就像这样

其他回答

拉拉维尔 5.3+

回退一步。本机。

php artisan migrate:rollback --step=1

这是手册页:文档。


Laravel 5.2及之前版本

不麻烦就没办法。详情请看Martin Bean的回答。

INSERT INTO homestead.bb_migrations (`migration`, `batch`)  VALUES ('2016_01_21_064436_create_victory_point_balance_table', '2')

就像这样

试试这个:

php artisan migrate:rollback --step=1

这是从Laravel 5.3 +工作

如果您想修改原始迁移文件并再次迁移它,您可以使用这个包进行迁移。(适用于Laravel 5.4或以上版本)

首先,在你的Laravel项目中安装包:

composer require caloskao/migrate-specific

在app/Console/Kernel.php中注册命令:

protected $commands = [
    \CalosKao\MigrateSpecific::class
];

现在,运行这个命令来迁移文件

php artisan migrate:specific database/migrations/table.php

正如Laravel手册中所述,您可以使用——step选项回滚特定数量的迁移

php artisan migrate:rollback --step=5