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

PopulateJobTerms   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
eloc 17
c 2
b 0
f 0
dl 0
loc 37
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 18 1
A down() 0 4 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class PopulateJobTerms extends Migration
8
{
9
    /**
10
    * Run the migrations.
11
    *
12
    * @return void
13
    */
14
    public function up()
15
    {
16
        DB::table('job_terms')->insert([
17
            ['id' => 1, 'name' => 'week'],
18
            ['id' => 2, 'name' => 'month'],
19
            ['id' => 3, 'name' => 'year'],
20
            ['id' => 4, 'name' => 'permanent'],
21
        ]);
22
23
        DB::table('job_term_translations')->insert([
24
            ['id' => 1, 'job_term_id' => 1, 'locale' => 'en', 'value' => 'week'],
25
            ['id' => 2, 'job_term_id' => 1, 'locale' => 'fr', 'value' => 'semaine'],
26
            ['id' => 3, 'job_term_id' => 2, 'locale' => 'en', 'value' => 'month'],
27
            ['id' => 4, 'job_term_id' => 2, 'locale' => 'fr', 'value' => 'mois'],
28
            ['id' => 5, 'job_term_id' => 3, 'locale' => 'en', 'value' => 'year'],
29
            ['id' => 6, 'job_term_id' => 3, 'locale' => 'fr', 'value' => 'an'],
30
            ['id' => 7, 'job_term_id' => 4, 'locale' => 'en', 'value' => 'permanent'],
31
            ['id' => 8, 'job_term_id' => 4, 'locale' => 'fr', 'value' => 'permanent'],
32
        ]);
33
    }
34
35
    /**
36
    * Reverse the migrations.
37
    *
38
    * @return void
39
    */
40
    public function down()
41
    {
42
        DB::table('job_terms')->whereIn('id', [1, 2, 3, 4])->delete();
43
        DB::table('job_term_translations')->whereIn('id', [1, 2, 3, 4, 5, 6, 7, 8])->delete();
44
    }
45
}
46