File tree Expand file tree Collapse file tree
app/sprinkles/account/src/Database/Migrations/v430 Expand file tree Collapse file tree Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments