Skip to content

Commit c0ddf44

Browse files
Merge pull request #28 from IFRCGo/bugfix/fix-migration-change-region-to-subnational
fix migration subnational
2 parents 9208901 + 774ac19 commit c0ddf44

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

database/migrations/2025_03_25_127530_change_region_to_subnational.php

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,33 @@
66

77
class ChangeRegionToSubnational extends Migration
88
{
9-
/**
10-
* Run the migrations.
11-
*
12-
* @return void
13-
*/
149
public function up()
1510
{
11+
Schema::table('usage_logs', function (Blueprint $table) {
12+
$table->string('subnational')->nullable();
13+
});
14+
1615
DB::table('usage_logs')->update([
1716
'subnational' => DB::raw('region')
1817
]);
18+
19+
Schema::table('usage_logs', function (Blueprint $table) {
20+
$table->dropColumn('region');
21+
});
1922
}
20-
21-
/**
22-
* Reverse the migrations.
23-
*
24-
* @return void
25-
*/
23+
2624
public function down()
27-
{
25+
{
26+
Schema::table('usage_logs', function (Blueprint $table) {
27+
$table->string('region')->nullable();
28+
});
2829

29-
DB::table('usage_logs')->update([
30-
'region' => DB::raw('subnational')
31-
]);
32-
}
30+
DB::table('usage_logs')->update([
31+
'region' => DB::raw('subnational')
32+
]);
33+
34+
Schema::table('usage_logs', function (Blueprint $table) {
35+
$table->dropColumn('subnational');
36+
});
37+
}
3338
}

0 commit comments

Comments
 (0)