Skip to content

Commit 626b3ae

Browse files
authored
Fix #1966 Duplicate entry 'roles_name_guard_name_unique' (#1970)
Co-authored-by: Erik Niebla <ep_niebla@hotmail.com>
1 parent 46fc8f2 commit 626b3ae

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

database/migrations/add_teams_fields.php.stub

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ class AddTeamsFields extends Migration
3131

3232
if (! Schema::hasColumn($tableNames['roles'], $columnNames['team_foreign_key'])) {
3333
Schema::table($tableNames['roles'], function (Blueprint $table) use ($columnNames) {
34-
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
34+
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable()->after('id');
3535
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
36+
37+
$table->dropUnique('roles_name_guard_name_unique');
38+
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
3639
});
3740
}
3841

0 commit comments

Comments
 (0)