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

AddForeignKeysToUserStoriesTable::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
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