laravel - 如何在 Laravel 迁移中的特定列之后订购多个新列

有什么好的方法吗?我目前通过以我想要的顺序的相反顺序列出列来做到这一点:

Schema::table('some_table', function($table){
    $table->string('new_col_2')->after('existing_col'); //How to specify that this should come after new_col_1?
    $table->string('new_col_1')->after('existing_col');
});

最佳答案

你试过吗:

Schema::table('some_table', function($table){
  $table->string('new_col_1')->after('existing_col');
  $table->string('new_col_2')->after('new_col_1');
}

https://stackoverflow.com/questions/53671239/

相关文章:

vue.js - 如何使用 Nuxt.js 在 vuex 状态中获取本地存储数据

matlab - 根据给定矩阵的对角线和反对角线创建新矩阵

react-native - React native如何改变WebView的背景色?

macos - 如何在 macOS 上获取 awk 版本?

node.js - 如何将字符串作为 gzip Nodejs 上传到 s3

python - 如何修复-没有这样的表 : main. auth_user__old

git - 如何通过 GitHub 的 API 进行 cherry-pick

google-colaboratory - 在 Google Colab notebook 上安装

python - Pandas - 从索引中提取月份和年份

html-table - 表中 1.5 的 Colspan