我使用的是Laravel 4.2,意外地丢失了migrations表内容。我不能运行任何迁移,因为表已经存在。
如何在migrations表中填充已有的表迁移?
发布于 2015-07-16 19:02:28
最后我解决了这个问题:
首先,我列出了所有的迁移文件(已经在数据库中迁移):
$files = File::allFiles('app/database/migrations');
foreach($files as $file)
{
$f = explode('/', $file);
echo replace('.php', '', (string)end($f)) . '<br>';
}然后我将它们插入到migrations表中,并更新了batch字段的值:
update migrations set batch = 1
https://stackoverflow.com/questions/31451497
复制相似问题