Skip to content

Commit 047258b

Browse files
committed
Changed foreign key to array value format
1 parent d207ca2 commit 047258b

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

app/sprinkles/account/src/Database/Migrations/v430/UpdateUsersTable.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ public function up()
3838
{
3939
if ($this->schema->hasTable('users')) {
4040
$this->schema->table('users', function (Blueprint $table) {
41-
$table->dropForeign('users_group_id_foreign');
41+
$table->dropForeign(['group_id']);
4242
$table->unsignedInteger('group_id')->default(null)->comment('The id of the user group.')->nullable()->change();
43+
});
44+
$this->schema->table('users', function (Blueprint $table) {
4345
$table->foreign('group_id')->references('id')->on('groups');
4446
});
4547
}
@@ -51,8 +53,10 @@ public function up()
5153
public function down()
5254
{
5355
$this->schema->table('users', function (Blueprint $table) {
54-
$table->dropForeign('users_group_id_foreign');
56+
$table->dropForeign(['group_id']);
5557
$table->unsignedInteger('group_id')->default(1)->comment('The id of the user group.')->nullable(false)->change();
58+
});
59+
$this->schema->table('users', function (Blueprint $table) {
5660
$table->foreign('group_id')->references('id')->on('groups');
5761
});
5862
}

0 commit comments

Comments
 (0)