diff --git a/database/migrations/2024_03_8_101930_create_code_indicator.php b/database/migrations/2024_03_8_101930_create_code_indicator.php index 7c9af3d9d..a9c351da1 100644 --- a/database/migrations/2024_03_8_101930_create_code_indicator.php +++ b/database/migrations/2024_03_8_101930_create_code_indicator.php @@ -26,52 +26,6 @@ public function up() $table->softDeletes(); $table->timestamps(); }); - $indicators = [ - [ - 'name' => 'Tree cover (TTC)', - 'unit' => 'Percent', - 'description' => 'Percent tree cover of each site polygon', - 'is_active' => 1 - ], - [ - 'name' => 'Tree cover loss', - 'unit' => 'Ha', - 'description' => 'Tree cover loss in hectares', - 'is_active' => 1 - ], - [ - 'name' => 'Tree cover loss from fires', - 'unit' => 'Ha', - 'description' => 'Tree cover loss from fires in hectares', - 'is_active' => 1 - ], - [ - 'name' => 'Hectares under restoration by WWF ecoregion', - 'unit' => 'Ha', - 'description' => 'Area value for each ecoregion type', - 'is_active' => 1 - ], - [ - 'name' => 'Hectares under restoration by intervention type', - 'unit' => 'Ha', - 'description' => 'Area value for each intervention type', - 'is_active' => 1 - ], - [ - 'name' => 'Tree count', - 'unit' => 'Count', - 'description' => 'Tree count number and confidence value', - 'is_active' => 1 - ], - ]; - $now = now(); - foreach ($indicators as $indicator) { - $indicator['uuid'] = Str::uuid(); - $indicator['uuid_primary'] = $indicator['uuid']; - $indicator['created_at'] = $now; - $indicator['updated_at'] = $now; - DB::table('code_indicator')->insert($indicator); - } } /** diff --git a/database/seeders/CodeIndicator.php b/database/seeders/CodeIndicator.php new file mode 100644 index 000000000..1b2b3f74b --- /dev/null +++ b/database/seeders/CodeIndicator.php @@ -0,0 +1,63 @@ + 'Tree cover (TTC)', + 'unit' => 'Percent', + 'description' => 'Percent tree cover of each site polygon', + 'is_active' => 1 + ], + [ + 'name' => 'Tree cover loss', + 'unit' => 'Ha', + 'description' => 'Tree cover loss in hectares', + 'is_active' => 1 + ], + [ + 'name' => 'Tree cover loss from fires', + 'unit' => 'Ha', + 'description' => 'Tree cover loss from fires in hectares', + 'is_active' => 1 + ], + [ + 'name' => 'Hectares under restoration by WWF ecoregion', + 'unit' => 'Ha', + 'description' => 'Area value for each ecoregion type', + 'is_active' => 1 + ], + [ + 'name' => 'Hectares under restoration by intervention type', + 'unit' => 'Ha', + 'description' => 'Area value for each intervention type', + 'is_active' => 1 + ], + [ + 'name' => 'Tree count', + 'unit' => 'Count', + 'description' => 'Tree count number and confidence value', + 'is_active' => 1 + ], + ]; + $now = now(); + foreach ($indicators as $indicator) { + $indicator['uuid'] = Str::uuid(); + $indicator['uuid_primary'] = $indicator['uuid']; + $indicator['created_at'] = $now; + $indicator['updated_at'] = $now; + DB::table('code_indicator')->insert($indicator); + } + } +}