BrandTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 35
dl 0
loc 61
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 42 1
A down() 0 2 1
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class BrandTable extends Migration
7
{
8
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        // Creates the users table
17
        Schema::create('brand', function ($table) {
18
            $table->increments('id');
19
            $table->boolean('active')->default(false);
20
            $table->string('reference_code')->nullable();
21
            $table->string('title');
22
            $table->string('short_description')->nullable();
23
            $table->text('description')->nullable();
24
            $table->string('meta_title')->nullable();
25
            $table->string('meta_description')->nullable();
26
            $table->string('meta_keywords')->nullable();
27
            $table->integer('rank')->default(0);
28
            $table->integer('shop_id')->unsigned();
29
            $table->foreign('shop_id')->references('id')->on('shop')->onDelete('cascade');
30
            $table->string('slug');
31
            $table->integer('modified_by_user_id')->unsigned()->nullable();
32
            $table->foreign('modified_by_user_id')->references('id')->on('user')->onDelete('set null');
33
            $table->unique(array('title','shop_id'), 'unique_brand_title');
34
            $table->timestamps();
35
        });
36
37
        Schema::create('brand_image', function (Blueprint $table) {
38
            $table->increments('id');
39
            $table->integer('brand_id')->unsigned();
40
            $table->foreign('brand_id')->references('id')->on('brand')->onDelete('cascade');
41
            ;
42
            $table->string('file')->nullable();
43
            $table->string('path')->nullable();
44
            $table->integer('size')->nullable();
45
            $table->string('extension')->nullable();
46
            $table->integer('rank')->default(0);
47
            $table->string('tag')->nullable();
48
            $table->integer('modified_by_user_id')->unsigned()->nullable();
49
            $table->foreign('modified_by_user_id')->references('id')->on('user')->onDelete('set null');
50
            $table->timestamps();
51
        });
52
53
        Schema::table('product', function (Blueprint $table) {
54
            $table->integer('brand_id')->unsigned()->nullable();
55
            $table->foreign('brand_id')->references('id')->on('brand')->onDelete('set null');
56
        });
57
    }
58
59
60
    /**
61
     * Reverse the migrations.
62
     *
63
     * @return void
64
     */
65
    public function down()
66
    {
67
     //
68
    }
69
}
70