CreateForeignKeyVueGuard   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 51
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 0 25 1
A down() 0 12 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateForeignKeyVueGuard extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {               
16
        Schema::table('workflow_guards', function(Blueprint $table){
17
            $table->foreign('workflow_id')
18
            ->references('id')
19
            ->on('workflows')
20
            ->onDelete('set null')
21
            ->onUpdate('restrict');
22
        });
23
        Schema::table('workflow_guards', function(Blueprint $table){
24
            $table->foreign('transition_id')
25
            ->references('id')
26
            ->on('workflow_transition')
27
            ->onDelete('set null')
28
            ->onUpdate('restrict');
29
        });
30
        Schema::table('workflow_guards', function(Blueprint $table){
31
            $table->foreign('permission_id')
32
            ->references('id')
33
            ->on('permissions')
34
            ->onDelete('set null')
35
            ->onUpdate('restrict');
36
        });
37
        
38
    }
39
40
    /**
41
     * Reverse the migrations.
42
     *
43
     * @return void
44
     */
45
    public function down()
46
    {
47
        Schema::table('workflow_guards', function(Blueprint $table) {
48
            $table->dropForeign('workflow_guards_workflow_id_foreign');         
49
        });
50
        Schema::table('workflow_guards', function(Blueprint $table) {
51
            $table->dropForeign('workflow_guards_transition_id_foreign');         
52
        });
53
        Schema::table('workflow_guards', function(Blueprint $table) {
54
            $table->dropForeign('workflow_guards_permission_id_foreign');         
55
        });
56
    }
57
}
58