From f7490176ec5895384f2aaf6f3cb05997a543824e Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 13 Nov 2020 14:03:04 +0100 Subject: [PATCH] Expand table. --- .../2020_11_12_070604_changes_for_v550.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/database/migrations/2020_11_12_070604_changes_for_v550.php b/database/migrations/2020_11_12_070604_changes_for_v550.php index 6e5b7c752a..d21a24a4d8 100644 --- a/database/migrations/2020_11_12_070604_changes_for_v550.php +++ b/database/migrations/2020_11_12_070604_changes_for_v550.php @@ -16,6 +16,7 @@ class ChangesForV550 extends Migration */ public function down() { + // recreate jobs table. Schema::drop('jobs'); Schema::create( 'jobs', @@ -32,13 +33,26 @@ class ChangesForV550 extends Migration $table->index(['queue', 'reserved', 'reserved_at']); } ); + + // expand budget / transaction journal table. Schema::table( 'budget_transaction_journal', function (Blueprint $table) { $table->dropForeign('budget_id_foreign'); $table->dropColumn('budget_limit_id'); } ); + + // drop failed jobs table. Schema::dropIfExists('failed_jobs'); + + // drop fields from budget limits + Schema::table( + 'budget_limits', + static function (Blueprint $table) { + $table->dropColumn('repeat_freq'); + $table->dropColumn('auto_budget'); + } + ); } /** @@ -48,6 +62,7 @@ class ChangesForV550 extends Migration */ public function up() { + // drop and recreate jobs table. Schema::drop('jobs'); // this is the NEW table Schema::create( @@ -62,6 +77,7 @@ class ChangesForV550 extends Migration } ); + // create new failed_jobs table. Schema::create( 'failed_jobs', function (Blueprint $table) { $table->id(); @@ -74,6 +90,7 @@ class ChangesForV550 extends Migration } ); + // update budget / transaction journal table. Schema::table( 'budget_transaction_journal', function (Blueprint $table) { $table->integer('budget_limit_id', false, true)->nullable()->default(null)->after('budget_id'); @@ -82,5 +99,15 @@ class ChangesForV550 extends Migration } ); + + // append budget limits table. + // i swear I dropped & recreated this field 15 times already. + Schema::table( + 'budget_limits', + static function (Blueprint $table) { + $table->string('repeat_freq', 12)->nullable(); + $table->boolean('auto_budget')->default(false); + } + ); } }