Completed
Push — dev ( dd0a5f...f4c322 )
by Tristan
21:24 queued 06:16
created

PopulateDepartments::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 36
Code Lines 32

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 32
c 3
b 0
f 0
dl 0
loc 36
rs 9.408
cc 1
nc 1
nop 0
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class PopulateDepartments extends Migration
8
{
9
    /**
10
    * Run the migrations.
11
    *
12
    * @return void
13
    */
14
    public function up()
15
    {
16
        DB::table('departments')->insert([
17
            ['id' => 1, 'name' => 'treasury_board'],
18
            ['id' => 2, 'name' => 'natural_resources'],
19
            ['id' => 3, 'name' => 'transport'],
20
            ['id' => 4, 'name' => 'enviroment_and_climate_change'],
21
            ['id' => 5, 'name' => 'employment_and_social_development'],
22
            ['id' => 6, 'name' => 'global_affairs'],
23
            ['id' => 7, 'name' => 'fisheries_and_oceans'],
24
            ['id' => 8, 'name' => 'innovation_science'],
25
            ['id' => 9, 'name' => 'public_service_and_procurement'],
26
            ['id' => 10, 'name' => 'border_services_agency'],
27
        ]);
28
29
        DB::table('department_translations')->insert([
30
            ['id' => 1, 'department_id' => 1, 'locale' => 'en', 'value' => 'Treasury Board of Canada Secretariat'],
31
            ['id' => 2, 'department_id' => 1, 'locale' => 'fr', 'value' => 'Secrétariat du Conseil du Trésor du Canada'],
32
            ['id' => 3, 'department_id' => 2, 'locale' => 'en', 'value' => 'Natural Resources Canada'],
33
            ['id' => 4, 'department_id' => 2, 'locale' => 'fr', 'value' => 'Ressources naturelles Canada'],
34
            ['id' => 5, 'department_id' => 3, 'locale' => 'en', 'value' => 'Transport Canada'],
35
            ['id' => 6, 'department_id' => 3, 'locale' => 'fr', 'value' => 'Transports Canada'],
36
            ['id' => 7, 'department_id' => 4, 'locale' => 'en', 'value' => 'Environment and Climate Change Canada'],
37
            ['id' => 8, 'department_id' => 4, 'locale' => 'fr', 'value' => 'Environnement et Changement climatique Canada'],
38
            ['id' => 9, 'department_id' => 5, 'locale' => 'en', 'value' => 'Employment and Social Development Canada'],
39
            ['id' => 10, 'department_id' => 5, 'locale' => 'fr', 'value' => 'Emploi et Développement social Canada'],
40
            ['id' => 11, 'department_id' => 6, 'locale' => 'en', 'value' => 'Global Affairs Canada'],
41
            ['id' => 12, 'department_id' => 6, 'locale' => 'fr', 'value' => 'Affaires mondiales Canada'],
42
            ['id' => 13, 'department_id' => 7, 'locale' => 'en', 'value' => 'Fisheries and Oceans Canada'],
43
            ['id' => 14, 'department_id' => 7, 'locale' => 'fr', 'value' => 'Pêches et Océans Canada'],
44
            ['id' => 15, 'department_id' => 8, 'locale' => 'en', 'value' => 'Innovation, Science and Economic Development Canada'],
45
            ['id' => 16, 'department_id' => 8, 'locale' => 'fr', 'value' => 'Innovation, Sciences et Développement économique Canada'],
46
            ['id' => 17, 'department_id' => 9, 'locale' => 'en', 'value' => 'Public Services and Procurement Canada'],
47
            ['id' => 18, 'department_id' => 9, 'locale' => 'fr', 'value' => 'Services publics et Approvisionnement Canada'],
48
            ['id' => 19, 'department_id' => 10, 'locale' => 'en', 'value' => 'Canada Border Services Agency'],
49
            ['id' => 20, 'department_id' => 10, 'locale' => 'fr', 'value' => 'Agence des services frontaliers du Canada'],
50
        ]);
51
    }
52
53
    /**
54
    * Reverse the migrations.
55
    *
56
    * @return void
57
    */
58
    public function down()
59
    {
60
        DB::table('departments')->whereIn('id', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])->delete();
61
        DB::table('department_translations')->whereIn('id', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20])->delete();
62
    }
63
}
64