From bad2feaafdb19cb15fe47472e692fa93645a48ba Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 6 Apr 2017 21:42:57 +0300 Subject: [PATCH] Fix for down migrations --- .../2015_02_12_102940_add_email_templates.php | 12 ++++---- .../2015_09_10_185135_add_reminder_emails.php | 28 ++++++++++--------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/database/migrations/2015_02_12_102940_add_email_templates.php b/database/migrations/2015_02_12_102940_add_email_templates.php index 64f6afd52d28..8332b18d6991 100644 --- a/database/migrations/2015_02_12_102940_add_email_templates.php +++ b/database/migrations/2015_02_12_102940_add_email_templates.php @@ -25,10 +25,12 @@ class AddEmailTemplates extends Migration */ public function down() { - Schema::table('accounts', function ($table) { - $table->dropColumn('email_template_invoice'); - $table->dropColumn('email_template_quote'); - $table->dropColumn('email_template_payment'); - }); + if (Schema::hasColumn('accounts', 'email_template_invoice')) { + Schema::table('accounts', function ($table) { + $table->dropColumn('email_template_invoice'); + $table->dropColumn('email_template_quote'); + $table->dropColumn('email_template_payment'); + }); + } } } diff --git a/database/migrations/2015_09_10_185135_add_reminder_emails.php b/database/migrations/2015_09_10_185135_add_reminder_emails.php index bba394f3908e..9b6a4ea46c0a 100644 --- a/database/migrations/2015_09_10_185135_add_reminder_emails.php +++ b/database/migrations/2015_09_10_185135_add_reminder_emails.php @@ -42,22 +42,24 @@ class AddReminderEmails extends Migration public function down() { Schema::table('accounts', function ($table) { - $table->dropColumn('email_subject_invoice'); - $table->dropColumn('email_subject_quote'); - $table->dropColumn('email_subject_payment'); - - $table->dropColumn('email_subject_reminder1'); - $table->dropColumn('email_subject_reminder2'); - $table->dropColumn('email_subject_reminder3'); - - $table->dropColumn('email_template_reminder1'); - $table->dropColumn('email_template_reminder2'); - $table->dropColumn('email_template_reminder3'); - + if (Schema::hasColumn('accounts', 'email_subject_invoice')) { + $table->dropColumn('email_subject_invoice'); + $table->dropColumn('email_subject_quote'); + $table->dropColumn('email_subject_payment'); + + $table->dropColumn('email_subject_reminder1'); + $table->dropColumn('email_subject_reminder2'); + $table->dropColumn('email_subject_reminder3'); + + $table->dropColumn('email_template_reminder1'); + $table->dropColumn('email_template_reminder2'); + $table->dropColumn('email_template_reminder3'); + } + $table->dropColumn('enable_reminder1'); $table->dropColumn('enable_reminder2'); $table->dropColumn('enable_reminder3'); - + $table->dropColumn('num_days_reminder1'); $table->dropColumn('num_days_reminder2'); $table->dropColumn('num_days_reminder3');