Completed
Push — master ( 4b6b6a...392426 )
by David
43:13 queued 15:02
created

CreateForumPostsTable::up()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 12

Duplication

Lines 16
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 16
loc 16
rs 9.4285
cc 2
eloc 12
nc 2
nop 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6 View Code Duplication
class CreateForumPostsTable extends Migration
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
7
{
8
    public function up()
9
    {
10
        if (!Schema::hasTable('forum_posts')) {
11
            Schema::create('forum_posts', function ($table) {
12
                $table->increments('id');
13
                $table->string('title');
14
                $table->string('body', 4000);
15
                $table->integer('forum_id')->unsigned();
16
                $table->foreign('forum_id')
17
                      ->references('id')->on('forums')
18
                      ->onDelete('cascade');
19
                $table->integer('author_id');
20
                $table->timestamps();
21
            });
22
        }
23
    }
24
25
    public function down()
26
    {
27
        Schema::dropIfExists('forum_posts');
28
    }
29
}
30