From 84a24f033376118357ad7489725a8b369563b652 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 27 Dec 2014 05:38:33 +0100 Subject: [PATCH] Something with migrations. --- .../2014_07_17_183717_create_limits_table.php | 22 +++++++++---------- .../2014_12_24_191544_changes_for_v322.php | 13 +++++++++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/database/migrations/2014_07_17_183717_create_limits_table.php b/app/database/migrations/2014_07_17_183717_create_limits_table.php index fced678780..fc39882c7b 100644 --- a/app/database/migrations/2014_07_17_183717_create_limits_table.php +++ b/app/database/migrations/2014_07_17_183717_create_limits_table.php @@ -29,19 +29,19 @@ class CreateLimitsTable extends Migration { Schema::create( 'limits', function (Blueprint $table) { - $table->increments('id'); - $table->timestamps(); - $table->integer('component_id')->unsigned(); - $table->date('startdate'); - $table->decimal('amount', 10, 2); - $table->boolean('repeats'); - $table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']); + $table->increments('id'); + $table->timestamps(); + $table->integer('component_id')->unsigned(); + $table->date('startdate'); + $table->decimal('amount', 10, 2); + $table->boolean('repeats'); + $table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']); - $table->unique(['component_id', 'startdate', 'repeat_freq']); + $table->unique(['component_id', 'startdate', 'repeat_freq'], 'unique_ci_combi'); - // connect component - $table->foreign('component_id')->references('id')->on('components')->onDelete('cascade'); - } + // connect component + $table->foreign('component_id')->references('id')->on('components')->onDelete('cascade'); + } ); } diff --git a/app/database/migrations/2014_12_24_191544_changes_for_v322.php b/app/database/migrations/2014_12_24_191544_changes_for_v322.php index 4d400e97b7..5c377f7ec3 100644 --- a/app/database/migrations/2014_12_24_191544_changes_for_v322.php +++ b/app/database/migrations/2014_12_24_191544_changes_for_v322.php @@ -1,6 +1,7 @@ dropIndex('limits_component_id_startdate_repeat_freq_unique'); + +// try { + //$table->dropUnique('limits_component_id_startdate_repeat_freq_unique'); +// } catch (QueryException $e) { + //$table->dropUnique('unique_ci_combi'); +// } catch (PDOException $e) { +// $table->dropUnique('unique_ci_combi'); +// } + } ); // recreate it the correct way: