laravel - Laravel 迁移 - 将列放在另一列之前
问题描述
在 Laravel 中,我们有一个 after() 函数,它在给定列之后添加一列,例如:
$table->string('address_line2')->after('address_line1');
我想添加一个 before () 函数,它将在给定列之前添加一列。我会很感激你的帮助。
解决方案
There is no before()
modifier after checking with the Laravel documentation. But you should know your fields in the table and its order so you can use after()
modifier most of the time.
The only case that after()
can't do is to add a field before the first field but there is first()
modifier where you can put your field as the first field.
推荐阅读
- asp.net-core - 带有 Azure AD b2c 重定向 URL 的 Asp.Netcore Web 应用
- graphql - 在 Gatsby 中,如何将相对路径文件传递给同时拉取查询的模板?
- python - 如何导入和使用随 Conda 一起安装的 Python 库?
- java - 如何在 Cucumber for Java 中使用参数类型而不是正则表达式
- javascript - 从 JavaScript 在 chrome 选项卡中打开网络共享文件夹
- python - 从站点提取数据时数据重复
- ruby-on-rails - RAILS:将表单上的每个集合复选框保存为自己的对象
- sql-server - 出现错误“[01000] [unixODBC][驱动程序管理器]无法打开库'SQL Server Native Client 11.0':找不到文件(0)(SQLDriverConnect)
- java - Maven 在 clean 命令期间抛出错误 - Eclipse/Maven
- javascript - Javascript:如何导出通过 Chrome 内存选项卡找到的变量?