Passed
Push — master ( 2c3721...94fb22 )
by Grant
09:10 queued 10s
created

AddThingsToKnowColToWorkEnvironment   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 12
dl 0
loc 34
rs 10
c 0
b 0
f 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 AddThingsToKnowColToWorkEnvironment extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
17
        Schema::create('work_environment_translations', function (Blueprint $table) {
18
            $table->increments('id');
19
            $table->integer('work_environment_id')->unsigned();
20
            $table->string('locale');
21
            $table->text('things_to_know')->nullable();
22
            $table->timestamps();
23
24
            $table->unique(['work_environment_id', 'locale']);
25
        });
26
27
        Schema::table('work_environment_translations', function (Blueprint $table) {
28
            $table->foreign('work_environment_id')->references('id')->
29
                on('work_environments')->onUpdate('CASCADE')->onDelete('CASCADE');
30
        });
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        Schema::drop('work_environment_translations');
41
    }
42
}
43