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 @@ -37,7 +37,9 @@ public function up()
3737 {
3838 if ($ this ->schema ->hasTable ('users ' )) {
3939 $ this ->schema ->table ('users ' , function (Blueprint $ table ) {
40+ $ table ->dropForeign ('users_group_id_foreign ' );
4041 $ table ->integer ('group_id ' )->unsigned ()->default (null )->comment ('The id of the user group. ' )->nullable ()->change ();
42+ $ table ->foreign ('group_id ' )->references ('id ' )->on ('groups ' );
4143 });
4244 }
4345 }
@@ -48,7 +50,9 @@ public function up()
4850 public function down ()
4951 {
5052 $ this ->schema ->table ('users ' , function (Blueprint $ table ) {
53+ $ table ->dropForeign ('users_group_id_foreign ' );
5154 $ table ->integer ('group_id ' )->unsigned ()->default (1 )->comment ('The id of the user group. ' )->nullable (false )->change ();
55+ $ table ->foreign ('group_id ' )->references ('id ' )->on ('groups ' );
5256 });
5357 }
5458}
You can’t perform that action at this time.
0 commit comments