Completed
Push — feature/database_migrations ( 7a70e2...c6150e )
by Grant
19:20 queued 10:52
created

PopulateApplicationStatus::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
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 PopulateApplicationStatus extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        DB::table('application_status')->insert([
17
            ['id' => 1, 'name' => 'draft'],
18
            ['id' => 2, 'name' => 'submitted'],
19
            ['id' => 3, 'name' => 'requires_action'],
20
            ['id' => 4, 'name' => 'under_review'],
21
            ['id' => 5, 'name' => 'rejected'],
22
        ]);
23
24
        DB::table('application_status_translations')->insert([
25
            ['id' => 1, 'application_status_id' => 1, 'locale' => 'en', 'value' => 'Draft'],
26
            ['id' => 2, 'application_status_id' => 1, 'locale' => 'fr', 'value' => 'Provisoire'],
27
            ['id' => 3, 'application_status_id' => 2, 'locale' => 'en', 'value' => 'Submitted'],
28
            ['id' => 4, 'application_status_id' => 2, 'locale' => 'fr', 'value' => 'Soumis'],
29
            ['id' => 5, 'application_status_id' => 3, 'locale' => 'en', 'value' => 'Requires Action'],
30
            ['id' => 6, 'application_status_id' => 3, 'locale' => 'fr', 'value' => 'Nécessite une action'],
31
            ['id' => 7, 'application_status_id' => 4, 'locale' => 'en', 'value' => 'Under Review'],
32
            ['id' => 8, 'application_status_id' => 4, 'locale' => 'fr', 'value' => 'À létude'],
33
            ['id' => 9, 'application_status_id' => 5, 'locale' => 'en', 'value' => 'Rejected'],
34
            ['id' => 10, 'application_status_id' => 5, 'locale' => 'fr', 'value' => 'Rejeté'],
35
        ]);
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        DB::table('application_status')->whereIn('id', [1, 2, 3, 4, 5])->delete();
46
        DB::table('application_status_translations')->whereIn('id', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])->delete();
47
    }
48
}
49