From 0b3c0f6d5a91e8625642f362afda26e12d09a255 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 6 Oct 2017 20:39:11 -0500 Subject: [PATCH] Ah yes, lets just spend 30 minutes trying to get a migration to run correctly. --- ...10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php | 5 +++-- ...0_02_202007_ChangeToABetterUniqueServiceConfiguration.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php b/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php index 64d31f749..d7e9caa86 100644 --- a/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php +++ b/database/migrations/2017_10_02_202000_ChangeServicesToUseAMoreUniqueIdentifier.php @@ -41,10 +41,11 @@ class ChangeServicesToUseAMoreUniqueIdentifier extends Migration { Schema::table('services', function (Blueprint $table) { $table->dropColumn('uuid'); - $table->string('folder')->unique('file'); - $table->char('author', 36)->change(); + $table->string('folder')->nullable(); + $table->string('author', 36)->change(); $table->unique('name'); + $table->unique('folder', 'services_file_unique'); }); } } diff --git a/database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php b/database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php index 990a07a63..96a968144 100644 --- a/database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php +++ b/database/migrations/2017_10_02_202007_ChangeToABetterUniqueServiceConfiguration.php @@ -49,7 +49,7 @@ class ChangeToABetterUniqueServiceConfiguration extends Migration }); DB::transaction(function () { - DB::table('service_options')->select(['id', 'author'])->get()->each(function ($option) { + DB::table('service_options')->select(['id', 'tag'])->get()->each(function ($option) { DB::table('service_options')->where('id', $option->id)->update([ 'tag' => array_get(explode(':', $option->tag), 1), ]);