Skip to content

Commit 911995e

Browse files
authored
Wrap migration in a transaction
The migration may or or may not error, as it has values like `$userTable` that are not guaranteed to be provided.
1 parent f0b705f commit 911995e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/views/generators/migration.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ class EntrustSetupTables extends Migration
1212
*/
1313
public function up()
1414
{
15+
16+
DB::beginTransaction();
17+
1518
// Create table for storing roles
1619
Schema::create('{{ $rolesTable }}', function (Blueprint $table) {
1720
$table->increments('id');
@@ -55,6 +58,8 @@ public function up()
5558

5659
$table->primary(['permission_id', 'role_id']);
5760
});
61+
62+
DB::commit();
5863
}
5964

6065
/**

0 commit comments

Comments
 (0)