Passed
Push — dependabot/npm_and_yarn/string... ( b56eb5...bc569b )
by
unknown
45:46 queued 33s
created

CreatepagesTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 29
Code Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 24
nc 1
nop 0
dl 0
loc 29
rs 9.536
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreatepagesTable extends Migration
8
{
9
    public function up()
10
    {
11
        Schema::create('pages', function (Blueprint $table) {
12
            $table->increments('id');
13
            $table->string('collection', 32)->index()->default('singles');
14
            $table->boolean('published')->default(false);
15
            $table->boolean('featured')->default(false);
16
            $table->timestamp('archived_at')->default(null)->nullable();
17
            $table->boolean('hidden_in_menu')->default(false);
18
            $table->timestamp('publication')->nullable();
19
            $table->timestamp('start_at')->nullable();
20
            $table->timestamp('end_at')->nullable();
21
            $table->timestamps();
22
            $table->softDeletes();
23
        });
24
25
        Schema::create('page_translations', function (Blueprint $table) {
26
            $table->increments('id');
27
            $table->integer('page_id')->unsigned();
28
            $table->string('locale');
29
            $table->string('slug')->unique();
30
            $table->string('title');
31
            $table->text('content')->nullable();
32
            $table->text('short')->nullable();
33
            $table->string('seo_title')->nullable();
34
            $table->text('seo_description')->nullable();
35
            $table->timestamps();
36
37
            $table->foreign('page_id')->references('id')->on('pages')->onDelete('cascade');
38
        });
39
    }
40
41
    public function down()
42
    {
43
        Schema::dropIfExists('page_translations');
44
        Schema::dropIfExists('pages');
45
    }
46
}
47