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

PopulateRelationships::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 15
rs 9.9
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 PopulateRelationships extends Migration
8
{
9
    /**
10
    * Run the migrations.
11
    *
12
    * @return void
13
    */
14
    public function up()
15
    {
16
        DB::table('relationships')->insert([
17
            ['id' => 1, 'name' => 'superior'],
18
            ['id' => 2, 'name' => 'coworker'],
19
            ['id' => 3, 'name' => 'subordinate'],
20
        ]);
21
22
        DB::table('relationship_translations')->insert([
23
            ['id' => 1, 'relationship_id' => 1, 'locale' => 'en', 'value' => 'Superior'],
24
            ['id' => 2, 'relationship_id' => 1, 'locale' => 'fr', 'value' => 'Supérieur'],
25
            ['id' => 3, 'relationship_id' => 2, 'locale' => 'en', 'value' => 'Coworker'],
26
            ['id' => 4, 'relationship_id' => 2, 'locale' => 'fr', 'value' => 'Collaborateur'],
27
            ['id' => 5, 'relationship_id' => 3, 'locale' => 'en', 'value' => 'Subordinate'],
28
            ['id' => 6, 'relationship_id' => 3, 'locale' => 'fr', 'value' => 'Subalterne'],
29
        ]);
30
    }
31
32
    /**
33
    * Reverse the migrations.
34
    *
35
    * @return void
36
    */
37
    public function down()
38
    {
39
        DB::table('relationships')->whereIn('id', [1, 2, 3])->delete();
40
        DB::table('relationship_translations')->whereIn('id', [1, 2, 3, 4, 5, 6])->delete();
41
    }
42
}
43