From 27311e4f5fc90adefd69512408d5bf6a0ca64b08 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 27 Apr 2017 20:14:56 +0300 Subject: [PATCH] Remove duplicate 'Annually' frequency --- .../2017_04_16_101744_add_custom_contact_fields.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/database/migrations/2017_04_16_101744_add_custom_contact_fields.php b/database/migrations/2017_04_16_101744_add_custom_contact_fields.php index 0f4b1a67b1d4..89136dbbb6d1 100644 --- a/database/migrations/2017_04_16_101744_add_custom_contact_fields.php +++ b/database/migrations/2017_04_16_101744_add_custom_contact_fields.php @@ -45,6 +45,14 @@ class AddCustomContactFields extends Migration $table->string('transaction_reference')->nullable(); $table->foreign('payment_type_id')->references('id')->on('payment_types'); }); + + // remove duplicate annual frequency + if (DB::table('frequencies')->count() == 9) { + DB::statement('update invoices set frequency_id = 8 where is_recurring = 1 and frequency_id = 9'); + DB::statement('update accounts set reset_counter_frequency_id = 8 where reset_counter_frequency_id = 9'); + DB::statement('update frequencies set name = "Annually" where id = 8'); + DB::statement('delete from frequencies where id = 9'); + } } /**