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

PopulateExperienceLevels::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 17
c 1
b 0
f 0
dl 0
loc 21
rs 9.7
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 PopulateExperienceLevels extends Migration
8
{
9
    /**
10
    * Run the migrations.
11
    *
12
    * @return void
13
    */
14
    public function up()
15
    {
16
        DB::table('experience_levels')->insert([
17
            ['id' => 1, 'name' => '1 or less years'],
18
            ['id' => 2, 'name' => '2 - 3 years'],
19
            ['id' => 3, 'name' => '4 - 5 years'],
20
            ['id' => 4, 'name' => '6 - 7 years'],
21
            ['id' => 5, 'name' => '8 or more years'],
22
        ]);
23
24
        DB::table('experience_level_translations')->insert([
25
            ['id' => 1, 'experience_level_id' => 1, 'locale' => 'en', 'value' => '1 or less years'],
26
            ['id' => 2, 'experience_level_id' => 1, 'locale' => 'fr', 'value' => 'Un an ou moins'],
27
            ['id' => 3, 'experience_level_id' => 2, 'locale' => 'en', 'value' => '2 - 3 years'],
28
            ['id' => 4, 'experience_level_id' => 2, 'locale' => 'fr', 'value' => '2 - 3 ans'],
29
            ['id' => 5, 'experience_level_id' => 3, 'locale' => 'en', 'value' => '4 - 5 years'],
30
            ['id' => 6, 'experience_level_id' => 3, 'locale' => 'fr', 'value' => '4 - 5 ans'],
31
            ['id' => 7, 'experience_level_id' => 4, 'locale' => 'en', 'value' => '6 - 7 years'],
32
            ['id' => 8, 'experience_level_id' => 4, 'locale' => 'fr', 'value' => '6 - 7 ans'],
33
            ['id' => 9, 'experience_level_id' => 5, 'locale' => 'en', 'value' => '8 or more years'],
34
            ['id' => 10, 'experience_level_id' => 5, 'locale' => 'fr', 'value' => 'Huit ans ou plus'],
35
        ]);
36
    }
37
38
    /**
39
    * Reverse the migrations.
40
    *
41
    * @return void
42
    */
43
    public function down()
44
    {
45
        DB::table('experience_levels')->whereIn('id', [1, 2, 3, 4, 5])->delete();
46
        DB::table('experience_level_translations')->whereIn('id', [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])->delete();
47
    }
48
}
49