CreateBusinessOrganizationsTables::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
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 CreateBusinessOrganizationsTables extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        /**
17
         * Businesses
18
         */
19
        Schema::create(
20
            'businesses', function (Blueprint $table) {
21
                $table->engine = 'InnoDB';
22
                $table->string('code')->unique();
23
                $table->primary('code');
24
            
25
                $table->string('name', 255);
26
                $table->string('description')->nullable();
27
28
                $table->string('layoult')->nullable();
29
30
                $table->string('dominio')->nullable();
31
                $table->string('subdominio')->nullable();
32
33
                $table->string('type')->nullable();
34
                $table->integer('status')->nullable();
35
            
36
                $table->timestamps();
37
                $table->softDeletes();
38
            }
39
        );
40
        
41
        Schema::create(
42 View Code Duplication
            'businessables', function (Blueprint $table) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
                $table->engine = 'InnoDB';
44
                $table->string('businessable_id');
45
                $table->string('businessable_type', 255);
46
                $table->string('business_code');
47
                $table->foreign('business_code')->references('code')->on('businesses');
48
                $table->timestamps();
49
                $table->softDeletes();
50
            }
51
        );
52
        
53
        Schema::create(
54 View Code Duplication
            'business_sectors', function (Blueprint $table) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
55
                $table->increments('id');
56
                $table->string('name');
57
                $table->string('description')->nullable();
58
                $table->string('slug')->nullable();
59
                $table->integer('status')->default(1);
60
                $table->integer('business_sector_id')->unsigned()->nullable();
61
62
                $table->timestamps();
63
            }
64
        );
65
66
        Schema::create(
67
            'business_products', function (Blueprint $table) {
68
                $table->increments('id');
69
                $table->string('name');
70
                $table->integer('status')->default(1);
71
                $table->string('business_code')->nullable();
72
                $table->string('user_code')->nullable();
73
                $table->timestamps();
74
            }
75
        );
76
77
        // @todo Resolver isso aqui
78
        Schema::create(
79 View Code Duplication
            'business_collaborators', function (Blueprint $table) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
80
                $table->increments('id');
81
                $table->string('name')->nullable();
82
                $table->string('cpf')->nullable();
83
                $table->integer('status')->default(1);
84
                $table->string('business_code')->nullable();
85
                $table->string('user_code')->nullable();
86
                $table->timestamps();
87
            }
88
        );
89
90
91
    }
92
93
    /**
94
     * Reverse the migrations.
95
     *
96
     * @return void
97
     */
98
    public function down()
99
    {
100
        Schema::dropIfExists('business_products');
101
        Schema::dropIfExists('business_collaborators');
102
        Schema::dropIfExists('business_sectors');
103
        Schema::dropIfExists('organizations');
104
    }
105
}
106