Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix migration, change the migration #d1a0d96
Remove the transaction sentence that dose not work in
mysql DDL action.
Change drop() to dropIfExists() function.

Closes #678
  • Loading branch information
oldFuryBird committed Apr 4, 2018
commit 200d443b2cc536e03a08e28257c63b77f85d3eaa
21 changes: 13 additions & 8 deletions src/views/generators/migration.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ class EntrustSetupTables extends Migration
*/
public function up()
{
DB::beginTransaction();


try{

// Create table for storing roles
Schema::create('{{ $rolesTable }}', function (Blueprint $table) {
$table->increments('id');
Expand Down Expand Up @@ -56,9 +57,13 @@ public function up()
->onUpdate('cascade')->onDelete('cascade');

$table->primary(['permission_id', 'role_id']);
});
});
} catch (\Exception $err) {
$this->down();
throw $err;
}

DB::commit();

}

/**
Expand All @@ -68,9 +73,9 @@ public function up()
*/
public function down()
{
Schema::drop('{{ $permissionRoleTable }}');
Schema::drop('{{ $permissionsTable }}');
Schema::drop('{{ $roleUserTable }}');
Schema::drop('{{ $rolesTable }}');
Schema::dropIfExists('{{ $permissionRoleTable }}');
Schema::dropIfExists('{{ $permissionsTable }}');
Schema::dropIfExists('{{ $roleUserTable }}');
Schema::dropIfExists('{{ $rolesTable }}');
}
}