Completed
Push — master ( 7e54ec...8b45a6 )
by Vojta
9s
created

CreateReviewCategoryTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 14 1
A down() 0 4 1
1
<?php namespace VojtaSvoboda\Reviews\Updates;
2
3
use October\Rain\Database\Schema\Blueprint;
4
use October\Rain\Database\Updates\Migration;
5
use Schema;
6
7
class CreateReviewCategoryTable extends Migration
8
{
9
    public function up()
10
    {
11
        Schema::create('vojtasvoboda_reviews_review_category', function($table)
12
        {
13
            $table->engine = 'InnoDB';
14
            $table->increments('id')->unsigned();
15
            $table->integer('review_id')->unsigned()->nullable()->default(null);
16
            $table->integer('category_id')->unsigned()->nullable()->default(null);
17
            $table->index(['review_id', 'category_id']);
18
            $table->foreign('review_id')->references('id')->on('vojtasvoboda_reviews_reviews')->onDelete('cascade');
19
            $table->foreign('category_id')->references('id')->on('vojtasvoboda_reviews_categories')->onDelete('cascade');
20
            $table->timestamps();
21
        });
22
    }
23
24
    public function down()
25
    {
26
        Schema::dropIfExists('vojtasvoboda_reviews_review_category');
27
    }
28
}
29