LanguageTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 18
rs 9.8666
c 1
b 0
f 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class LanguageTable extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::create('language', function (Blueprint $table) {
16
            $table->increments('id');
17
            $table->text('language')->nullable();
18
            $table->integer('modified_by_user_id')->unsigned()->nullable();
19
            $table->foreign('modified_by_user_id')->references('id')->on('user')->onDelete('set null');
20
            $table->integer('shop_id')->unsigned();
21
            $table->foreign('shop_id')->references('id')->on('shop')->onDelete('cascade');
22
            $table->timestamps();
23
        });
24
    
25
        Schema::table('shop', function (Blueprint $table) {
26
            $table->foreign('language_id')->references('id')->on('language')->onDelete('set null');
27
        });
28
29
        Schema::table('user', function (Blueprint $table) {
30
            $table->foreign('language_id')->references('id')->on('language')->onDelete('set null');
31
        });
32
    }
33
34
    /**
35
     * Reverse the migrations.
36
     *
37
     * @return void
38
     */
39
    public function down()
40
    {
41
        Schema::drop('language');
42
    }
43
}
44