From 8c64a4ad55e970805e74dfce5748b5c814a10f31 Mon Sep 17 00:00:00 2001 From: notCharles Date: Sat, 7 Sep 2024 09:47:39 -0400 Subject: [PATCH] Make MySQL Happy MySQL complains when we try to change the rules column to json before we change the data... If we change the data, then change the column its happy. :) --- .../2024_07_25_072050_convert_rules_to_array.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/database/migrations/2024_07_25_072050_convert_rules_to_array.php b/database/migrations/2024_07_25_072050_convert_rules_to_array.php index 54eb7b136..6646a6661 100644 --- a/database/migrations/2024_07_25_072050_convert_rules_to_array.php +++ b/database/migrations/2024_07_25_072050_convert_rules_to_array.php @@ -12,13 +12,13 @@ return new class extends Migration */ public function up(): void { - Schema::table('egg_variables', function (Blueprint $table) { - $table->json('rules')->change(); - }); - DB::table('egg_variables')->select(['id', 'rules'])->cursor()->each(function ($eggVariable) { DB::table('egg_variables')->where('id', $eggVariable->id)->update(['rules' => explode('|', $eggVariable->rules)]); }); + + Schema::table('egg_variables', function (Blueprint $table) { + $table->json('rules')->change(); + }); } /**