From e833052e8e4f40556b22bc3004734cebdb5f91da Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 8 Jul 2022 16:46:00 -0700 Subject: [PATCH] Check for column Signed-off-by: snipe --- ...001334_add_eula_to_checkout_acceptance.php | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/database/migrations/2022_03_09_001334_add_eula_to_checkout_acceptance.php b/database/migrations/2022_03_09_001334_add_eula_to_checkout_acceptance.php index 07101d169..ac4faa19a 100644 --- a/database/migrations/2022_03_09_001334_add_eula_to_checkout_acceptance.php +++ b/database/migrations/2022_03_09_001334_add_eula_to_checkout_acceptance.php @@ -13,10 +13,12 @@ class AddEulaToCheckoutAcceptance extends Migration */ public function up() { - Schema::table('checkout_acceptances', function (Blueprint $table) { - $table->text('stored_eula')->nullable()->default(null); - $table->string('stored_eula_file')->nullable()->default(null); - }); + if (!Schema::hasColumn('checkout_acceptances', 'stored_eula')) { + Schema::table('checkout_acceptances', function (Blueprint $table) { + $table->text('stored_eula')->nullable()->default(null); + $table->string('stored_eula_file')->nullable()->default(null); + }); + } } /** @@ -26,13 +28,15 @@ class AddEulaToCheckoutAcceptance extends Migration */ public function down() { - Schema::table('checkout_acceptances', function (Blueprint $table) { - if (Schema::hasColumn('checkout_acceptances', 'stored_eula')) { - $table->dropColumn('stored_eula'); - } - if (Schema::hasColumn('checkout_acceptances', 'stored_eula_file')) { - $table->dropColumn('stored_eula_file'); - } - }); + if (Schema::hasColumn('checkout_acceptances', 'stored_eula')) { + Schema::table('checkout_acceptances', function (Blueprint $table) { + if (Schema::hasColumn('checkout_acceptances', 'stored_eula')) { + $table->dropColumn('stored_eula'); + } + if (Schema::hasColumn('checkout_acceptances', 'stored_eula_file')) { + $table->dropColumn('stored_eula_file'); + } + }); + } } } \ No newline at end of file