Home  >  Article  >  Backend Development  >  laravel - php artisan migrate 表已经存在时怎么办?

laravel - php artisan migrate 表已经存在时怎么办?

WBOY
WBOYOriginal
2016-06-06 20:17:261946browse

我新增加了两张表,但 php artisan migrate 时说user表已经存在了,这是我上次建的表,但第二次执行php artisan migrate就报错了.

laravel - php artisan migrate 表已经存在时怎么办?

请问这怎样解决?

回复内容:

我新增加了两张表,但 php artisan migrate 时说user表已经存在了,这是我上次建的表,但第二次执行php artisan migrate就报错了.

laravel - php artisan migrate 表已经存在时怎么办?

请问这怎样解决?

我最近也碰到这个情况,我是这样做的

<code class="bash">mysqldump -uroot -p database > database.sql</code>

然后进入数据库,删掉这个库,然后重新创建。
然后source

<code class="bash">mysql > source ~/database.sql</code>

我就是这么做的。

可能不够优雅,不过没有任何问题。

希望有所帮助

你可以执行rollback命令。前提是你有写down()函数

<code>php artisan migrate:rollback</code>

把数据库里的这张表删了呗。。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn