我需要首先使用 laravel 迁移在 Sql 中添加一列。我可以使用 after 在任何地方添加新列:
Schema::table('tasks', function (Blueprint $table) {
if (Schema::hasColumn('tasks', 'assigned_to_id') == false) {
$table->integer('assigned_to_id')->after('status');
}
});
表有以下字段: project_id , module_id
我需要在 project_id 之前添加列“id”。如何实现这一目标?提前致谢!
LEATH