diff --git a/database/migrations/2021_02_05_172502_add_provider_to_oauth_table.php b/database/migrations/2021_02_05_172502_add_provider_to_oauth_table.php index 7c74d47e3..b2dff776e 100644 --- a/database/migrations/2021_02_05_172502_add_provider_to_oauth_table.php +++ b/database/migrations/2021_02_05_172502_add_provider_to_oauth_table.php @@ -14,9 +14,16 @@ class AddProviderToOauthTable extends Migration */ public function up() { - Schema::table('oauth_clients', function (Blueprint $table) { - $table->string('provider')->after('secret')->nullable(); - }); + // Add a 'provider' column if not existing or else modify it + if (!Schema::hasColumn('oauth_clients', 'provider')) { + Schema::table('oauth_clients', function (Blueprint $table) { + $table->string('provider')->after('secret')->nullable(); + }); + } else { + Schema::table('oauth_clients', function (Blueprint $table) { + $table->string('provider')->after('secret')->nullable()->change(); + }); + } } /** @@ -26,9 +33,10 @@ class AddProviderToOauthTable extends Migration */ public function down() { - Schema::table('oauth_clients', function (Blueprint $table) { - $table->dropColumn('provider'); - }); - + if (Schema::hasColumn('oauth_clients', 'provider')) { + Schema::table('oauth_clients', function (Blueprint $table) { + $table->dropColumn('provider'); + }); + } } }