laravel迁移重新组织列顺序 [英] laravel migration re-organising column order
本文介绍了laravel迁移重新组织列顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当您在表中创建新列时,可以使用-> after('column name')指示其去向.如何创建一个迁移,以所需的正确顺序对列进行重新排序?
When you create a new column in a table you can use the ->after('column name') to dictate where it goes. How can I create a migration that re-orders the columns in the right order I want?
推荐答案
尝试一下,希望它可以帮助您找到正确的解决方案:
Try this, hope it help you to find right solution:
public function up()
{
DB::statement("ALTER TABLE example MODIFY COLUMN foo DATE AFTER bar");
}
public function down()
{
DB::statement("ALTER TABLE example MODIFY COLUMN foo DATE AFTER bar");
}
这篇关于laravel迁移重新组织列顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文