CreatePagesTables   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 51
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 0 32 1
A down() 0 5 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
class CreatePagesTables extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::create('page__pages', function (Blueprint $table) {
16
            $table->engine = 'InnoDB';
17
            $table->increments('id');
18
            $table->boolean('is_home')->default(0);
19
            $table->string('template');
20
            $table->timestamps();
21
        });
22
23
        Schema::create('page__page_translations', function (Blueprint $table) {
24
            $table->engine = 'InnoDB';
25
            $table->increments('id');
26
            $table->integer('page_id')->unsigned();
27
            $table->string('locale')->index();
28
29
            $table->string('title');
30
            $table->string('slug');
31
            $table->boolean('status')->default(1);
32
            $table->text('body');
33
            $table->string('meta_title')->nullable();
34
            $table->string('meta_description')->nullable();
35
            $table->string('og_title')->nullable();
36
            $table->string('og_description')->nullable();
37
            $table->string('og_image')->nullable();
38
            $table->string('og_type')->nullable();
39
40
            $table->unique(['page_id', 'locale']);
41
            $table->foreign('page_id')->references('id')->on('page__pages')->onDelete('cascade');
42
            $table->timestamps();
43
        });
44
    }
45
46
    /**
47
     * Reverse the migrations.
48
     *
49
     * @return void
50
     */
51
    public function down()
52
    {
53
        Schema::drop('page__page_translations');
54
        Schema::drop('page__pages');
55
    }
56
}
57