CreateBlocksTables   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 21 1
A down() 0 5 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
class CreateBlocksTables extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     * @return void
11
     */
12
    public function up()
13
    {
14
        Schema::create('block__blocks', function (Blueprint $table) {
15
            $table->engine = 'InnoDB';
16
            $table->increments('id');
17
            $table->string('name');
18
            $table->timestamps();
19
        });
20
21
        Schema::create('block__blocks_translations', function (Blueprint $table) {
22
            $table->engine = 'InnoDB';
23
            $table->increments('id');
24
            $table->tinyInteger('online')->nullable();
25
            $table->text('body')->nullable();
26
27
            $table->integer('block_id')->unsigned();
28
            $table->string('locale')->index();
29
            $table->unique(['block_id', 'locale']);
30
            $table->foreign('block_id')->references('id')->on('block__blocks')->onDelete('cascade');
31
        });
32
    }
33
34
    /**
35
     * Reverse the migrations.
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        Schema::drop('block__blocks');
41
        Schema::drop('block__blocks_translations');
42
    }
43
}
44