Completed
Push — feature/database_migrations ( f00c1a...e56be6 )
by Grant
13:43 queued 11s
created

PopulateCriteriaTypes::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 8
c 2
b 0
f 1
dl 0
loc 12
rs 10
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 PopulateCriteriaTypes extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
     public function up()
15
     {
16
         DB::table('criteria_types')->insert([
17
             ['id' => 1, 'name' => 'essential'],
18
             ['id' => 2, 'name' => 'asset'],
19
         ]);
20
21
         DB::table('criteria_type_translations')->insert([
22
             ['id' => 1, 'criteria_type_id' => 1, 'locale' => 'en', 'value' => 'Need to Have', 'description' => ''],
23
             ['id' => 2, 'criteria_type_id' => 1, 'locale' => 'fr', 'value' => 'Qualifications essentielles', 'description' => ''],
24
             ['id' => 3, 'criteria_type_id' => 2, 'locale' => 'en', 'value' => 'Nice to Have', 'description' => ''],
25
             ['id' => 4, 'criteria_type_id' => 2, 'locale' => 'fr', 'value' => 'Qualifications constituant un atout', 'description' => ''],
26
         ]);
27
     }
28
29
     /**
30
      * Reverse the migrations.
31
      *
32
      * @return void
33
      */
34
     public function down()
35
     {
36
         DB::table('criteria_types')->whereIn('id', [1, 2])->delete();
37
         DB::table('criteria_type_translations')->whereIn('id', [1, 2, 3, 4])->delete();
38
     }
39
 }
40