laravel 4 artisan-如何回滚到特定的迁移状态? [英] laravel 4 artisan -- how to rollback to a specific migration state?

查看:47
本文介绍了laravel 4 artisan-如何回滚到特定的迁移状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我得到了a.phpb.phpc.phpd.php迁移类文件.如何回滚到特定的迁移状态,例如使用工匠命令在b.php中定义的状态?

Say i got a.php, b.php, c.php and d.php migration classes files. How to rollback to a specific migration state, the state defined within b.php for example, with artisan command ?

推荐答案

恐怕您不能直接这样做.

I am afraid, you cannot do this directly.

您可以: 1,回滚上一次迁移操作(所有迁移均在最后一批中运行)

You can: 1, Rollback The Last Migration Operation (all migrations ran in the last batch)

php artisan migrate:rollback

2,回滚所有迁移

php artisan migrate:reset

3,回滚所有迁移,然后再次运行它们

3, Rollback all migrations and run them all again

php artisan migrate:refresh  
php artisan migrate:refresh --seed

根据您的情况,修改b.php及其up()方法,然后执行artisan migrate:refresh命令.

In your situation, modify b.php and it's up() method, then execute artisan migrate:refresh command.

这篇关于laravel 4 artisan-如何回滚到特定的迁移状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆