From 1f244c94d43c040abb58b6dd4ce12a7cb7ef50e0 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 6 Apr 2017 21:48:56 +0300 Subject: [PATCH] Fix for down migrations --- .../2015_04_16_122647_add_partial_amount_to_invoices.php | 8 ++++++-- database/migrations/2015_07_08_114333_simplify_tasks.php | 8 +++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/database/migrations/2015_04_16_122647_add_partial_amount_to_invoices.php b/database/migrations/2015_04_16_122647_add_partial_amount_to_invoices.php index ac07a0d78151..488940d63b8f 100644 --- a/database/migrations/2015_04_16_122647_add_partial_amount_to_invoices.php +++ b/database/migrations/2015_04_16_122647_add_partial_amount_to_invoices.php @@ -34,8 +34,12 @@ class AddPartialAmountToInvoices extends Migration }); Schema::table('accounts', function ($table) { - $table->dropColumn('utf8_invoices'); - $table->dropColumn('auto_wrap'); + if (Schema::hasColumn('accounts', 'utf8_invoices')) { + $table->dropColumn('utf8_invoices'); + } + if (Schema::hasColumn('accounts', 'auto_wrap')) { + $table->dropColumn('auto_wrap'); + } $table->dropColumn('subdomain'); }); } diff --git a/database/migrations/2015_07_08_114333_simplify_tasks.php b/database/migrations/2015_07_08_114333_simplify_tasks.php index 776f2c2b501b..84c6ffe1d88f 100644 --- a/database/migrations/2015_07_08_114333_simplify_tasks.php +++ b/database/migrations/2015_07_08_114333_simplify_tasks.php @@ -54,9 +54,11 @@ class SimplifyTasks extends Migration $table->integer('break_duration')->nullable(); }); - Schema::table('users', function ($table) { - $table->dropColumn('dark_mode'); - }); + if (Schema::hasColumn('accounts', 'dark_mode')) { + Schema::table('users', function ($table) { + $table->dropColumn('dark_mode'); + }); + } Schema::table('users', function ($table) { $table->integer('theme_id')->nullable(); });