Skip to content

Commit

Permalink
Fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
tuandm committed Mar 18, 2019
1 parent 4ee065c commit 3207bf4
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ class AddSimpleRoleToUserTable extends Migration
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('role')->default('editor');
});
if (!Schema::hasColumn('users', 'email')) {
Schema::table('users', function (Blueprint $table) {
$table->string('role')->default('editor');
});
}
}

/**
Expand All @@ -26,7 +28,7 @@ public function up()
public function down()
{
Schema::table('users', function (Blueprint $table) {
// $table->dropColumn('role');
$table->dropColumn('role');
});
}
}

0 comments on commit 3207bf4

Please sign in to comment.