Completed
Push — master ( e7dd5d...f635d3 )
by Renato
05:30
created

AddForeignKeysToUserStoriesTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 8 1
A down() 0 8 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
class AddForeignKeysToUserStoriesTable extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     */
11
    public function up()
12
    {
13
        Schema::table('user_stories', function (Blueprint $table) {
14
            $table->foreign('config_priority_id', 'fk_user_stories_config_priority_id')->references('id')->on('config_priorities')->onUpdate('NO ACTION')->onDelete('NO ACTION');
15
            $table->foreign('product_backlog_id', 'fk_user_stories_product_backlog_id')->references('id')->on('product_backlogs')->onUpdate('NO ACTION')->onDelete('NO ACTION');
16
            $table->foreign('user_id', 'fk_user_stories_user_id')->references('id')->on('users')->onUpdate('NO ACTION')->onDelete('NO ACTION');
17
        });
18
    }
19
20
    /**
21
     * Reverse the migrations.
22
     */
23
    public function down()
24
    {
25
        Schema::table('user_stories', function (Blueprint $table) {
26
            $table->dropForeign('fk_user_stories_config_priority_id');
27
            $table->dropForeign('fk_user_stories_product_backlog_id');
28
            $table->dropForeign('fk_user_stories_user_id');
29
        });
30
    }
31
}
32