CreatePostsTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 24
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 16
nc 1
nop 0
dl 0
loc 24
rs 9.7333
c 1
b 0
f 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreatePostsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('posts', function (Blueprint $table) {
17
            $table->id('id');
18
            $table->foreignId('category_id')->constrained('post_categories');
19
            $table->foreignId('user_id')->constrained();
20
21
            /*$table->integer('category_id')->unsigned();
22
            $table->foreign('category_id')->references('id')->on('post_categories');*/
23
24
            $table->string('title');
25
            $table->text('intro_text');
26
            $table->text('body');
27
            $table->boolean('featured')->default(0);
28
            $table->text('before_content')->nullable();
29
            $table->text('after_content')->nullable();
30
            $table->string('introimage')->nullable();
31
            $table->string('introimage_alt')->nullable();
32
33
            $table->datetime('publish_at')->nullable();
34
            $table->datetime('publish_until')->nullable();
35
            //$table->boolean('is_published')->default(false);
36
            $table->string('slug');
37
            $table->timestamps();
38
        });
39
    }
40
41
    /**
42
     * Reverse the migrations.
43
     *
44
     * @return void
45
     */
46
    public function down()
47
    {
48
        Schema::dropIfExists('posts');
49
    }
50
}
51