From b4e9e244f58599e788836619a6776cf95b417a83 Mon Sep 17 00:00:00 2001 From: Juan24 <93536474+juanbroder24@users.noreply.github.com> Date: Wed, 26 Mar 2025 12:02:56 -0300 Subject: [PATCH 1/2] update migrations --- ...5_120530_rename_regions_to_subnational.php | 30 +++++++++++++++++ ...25_127530_change_region_to_subnational.php | 32 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 database/migrations/2025_03_25_120530_rename_regions_to_subnational.php create mode 100644 database/migrations/2025_03_25_127530_change_region_to_subnational.php diff --git a/database/migrations/2025_03_25_120530_rename_regions_to_subnational.php b/database/migrations/2025_03_25_120530_rename_regions_to_subnational.php new file mode 100644 index 0000000..8239be4 --- /dev/null +++ b/database/migrations/2025_03_25_120530_rename_regions_to_subnational.php @@ -0,0 +1,30 @@ +string('subnational', 45)->nullable()->change(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('usage_logs', function (Blueprint $table) { + $table->string('region', 45)->nullable()->change(); + }); + } +} From a2bde7e210ee60eca05d12f8df5ece1d170c68b0 Mon Sep 17 00:00:00 2001 From: Juan24 <93536474+juanbroder24@users.noreply.github.com> Date: Thu, 27 Mar 2025 11:26:43 -0300 Subject: [PATCH 2/2] update migrations --- ...5_03_25_120530_rename_regions_to_subnational.php | 4 ++-- ...25_03_25_127530_change_region_to_subnational.php | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/database/migrations/2025_03_25_120530_rename_regions_to_subnational.php b/database/migrations/2025_03_25_120530_rename_regions_to_subnational.php index 8239be4..055dd63 100644 --- a/database/migrations/2025_03_25_120530_rename_regions_to_subnational.php +++ b/database/migrations/2025_03_25_120530_rename_regions_to_subnational.php @@ -13,7 +13,7 @@ class RenameRegionsToSubnational extends Migration */ public function up() { - Schema::rename('regions', 'subnational'); + Schema::rename('regions', 'subnationals'); } /** @@ -24,7 +24,7 @@ public function up() public function down() { - Schema::rename('subnational', 'regions'); + Schema::rename('subnationals', 'regions'); } } diff --git a/database/migrations/2025_03_25_127530_change_region_to_subnational.php b/database/migrations/2025_03_25_127530_change_region_to_subnational.php index a5f05ba..32a7ad9 100644 --- a/database/migrations/2025_03_25_127530_change_region_to_subnational.php +++ b/database/migrations/2025_03_25_127530_change_region_to_subnational.php @@ -13,9 +13,9 @@ class ChangeRegionToSubnational extends Migration */ public function up() { - Schema::table('usage_logs', function (Blueprint $table) { - $table->string('subnational', 45)->nullable()->change(); - }); + DB::table('usage_logs')->update([ + 'subnational' => DB::raw('region') + ]); } /** @@ -25,8 +25,9 @@ public function up() */ public function down() { - Schema::table('usage_logs', function (Blueprint $table) { - $table->string('region', 45)->nullable()->change(); - }); + + DB::table('usage_logs')->update([ + 'region' => DB::raw('subnational') + ]); } }