CreatePostsTable::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
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
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(config('blog.table_prefix', 'blog').'_posts', function (Blueprint $table) {
17
            $table->increments('id');
18
            $table->integer('category_id')->nullable();
19
            $table->index('category_id');
20
            $table->integer('user_id')->nullable();
21
            $table->index('user_id');
22
            $table->string('title');
23
            $table->string('sub_title')->nullable();
24
            $table->string('slug')->nullable();
25
            $table->string('excerpt')->nullable();
26
            $table->text('content')->nullable();
27
28
            $table->boolean('allow_comments')->default(
29
                config('blog.posts.allow_comments')
30
            )->nullable();
31
32
            $table->boolean('allow_guest_comments')->default(
33
                config('blog.posts.allow_guest_comments')
34
            )->nullable();
35
36
            $table->string('status')->nullable();
37
            $table->timestamp('published_at')->nullable();
38
            $table->timestamps();
39
            $table->softDeletes();
40
        });
41
    }
42
43
    /**
44
     * Reverse the migrations.
45
     *
46
     * @return void
47
     */
48
    public function down()
49
    {
50
        Schema::dropIfExists(config('blog.table_prefix', 'blog').'_posts');
51
    }
52
}
53