CreateBlocksTables::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
cc 1
nc 1
nop 0
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