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 32a7ad9..e2c0b98 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 @@ -6,28 +6,33 @@ class ChangeRegionToSubnational extends Migration { - /** - * Run the migrations. - * - * @return void - */ public function up() { + Schema::table('usage_logs', function (Blueprint $table) { + $table->string('subnational')->nullable(); + }); + DB::table('usage_logs')->update([ 'subnational' => DB::raw('region') ]); + + Schema::table('usage_logs', function (Blueprint $table) { + $table->dropColumn('region'); + }); } - - /** - * Reverse the migrations. - * - * @return void - */ + public function down() - { +{ + Schema::table('usage_logs', function (Blueprint $table) { + $table->string('region')->nullable(); + }); - DB::table('usage_logs')->update([ - 'region' => DB::raw('subnational') - ]); - } + DB::table('usage_logs')->update([ + 'region' => DB::raw('subnational') + ]); + + Schema::table('usage_logs', function (Blueprint $table) { + $table->dropColumn('subnational'); + }); +} }