Skip to content

Commit 2e1cddd

Browse files
committed
unique constraint for user and role
1 parent c1ce28a commit 2e1cddd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

database/migrations/2020_03_16_055658_create_roles_table.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public function up()
1919
$table->integer('role_id')->unsigned();
2020
$table->integer('user_id')->unsigned();
2121
$table->timestamps();
22+
23+
$table->unique(['user_id', 'role_id']);
2224
});
2325
}
2426

0 commit comments

Comments
 (0)