CreatePagesTables::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
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