22
33use Illuminate \Database \Migrations \Migration ;
44use Illuminate \Database \Schema \Blueprint ;
5+ use Illuminate \Support \Facades \Schema ;
56
67class CreateRolesPermissionsTables extends Migration
78{
@@ -13,22 +14,22 @@ class CreateRolesPermissionsTables extends Migration
1314 public function up ()
1415 {
1516 Schema::create ('roles ' , function (Blueprint $ table ) {
16- $ table ->increments ('id ' );
17+ $ table ->bigIncrements ('id ' );
1718 $ table ->string ('name ' );
1819 $ table ->string ('label ' )->nullable ();
1920 $ table ->timestamps ();
2021 });
2122
2223 Schema::create ('permissions ' , function (Blueprint $ table ) {
23- $ table ->increments ('id ' );
24+ $ table ->bigIncrements ('id ' );
2425 $ table ->string ('name ' );
2526 $ table ->string ('label ' )->nullable ();
2627 $ table ->timestamps ();
2728 });
2829
2930 Schema::create ('permission_role ' , function (Blueprint $ table ) {
30- $ table ->integer ('permission_id ' )-> unsigned ( );
31- $ table ->integer ('role_id ' )-> unsigned ( );
31+ $ table ->unsignedBigInteger ('permission_id ' );
32+ $ table ->unsignedBigInteger ('role_id ' );
3233
3334 $ table ->foreign ('permission_id ' )
3435 ->references ('id ' )
@@ -44,12 +45,9 @@ public function up()
4445 });
4546
4647 Schema::create ('role_user ' , function (Blueprint $ table ) {
47- $ table ->integer ('role_id ' )->unsigned ();
48- if (\App::VERSION () >= '5.8 ' ) {
49- $ table ->bigInteger ('user_id ' )->unsigned ();
50- } else {
51- $ table ->integer ('user_id ' )->unsigned ();
52- }
48+ $ table ->unsignedBigInteger ('role_id ' );
49+ $ table ->unsignedBigInteger ('user_id ' );
50+
5351
5452 $ table ->foreign ('role_id ' )
5553 ->references ('id ' )
0 commit comments