CreateToDoListTables::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 59
Code Lines 40

Duplication

Lines 40
Ratio 67.8 %
Metric Value
dl 40
loc 59
rs 9.597
cc 1
eloc 40
nc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateToDoListTables extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
17 View Code Duplication
        Schema::create('Task', function (Blueprint $table) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
18
            $table->increments('id');
19
            $table->string('title', 50);
20
            $table->string('description', 250)->nullable();
21
            $table->tinyInteger('status');
22
            $table->timestamps();
23
            $table->softDeletes();
24
        });
25
26 View Code Duplication
        Schema::create('TaskList', function (Blueprint $table) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
27
            $table->increments('id');
28
            $table->string('name', 50);
29
            $table->string('description', 250)->nullable();
30
            $table->timestamps();
31
            $table->softDeletes();
32
        });
33
34 View Code Duplication
        Schema::create('Task_TaskList', function (Blueprint $table) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
35
            $table->increments('id');
36
            $table->integer('task')->unsigned();
37
            $table->integer('tasklist')->unsigned();
38
            $table->integer('order');
39
40
            $table->foreign('task')->references('id')->on('Task');
41
            $table->foreign('tasklist')->references('id')->on('TaskList');
42
        });
43
44 View Code Duplication
        Schema::create('Task_User', function (Blueprint $table) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
45
            $table->increments('id');
46
            $table->integer('task')->unsigned();
47
            $table->integer('user')->unsigned();
48
49
            $table->foreign('task')->references('id')->on('Task');
50
            $table->foreign('user')->references('id')->on('User');
51
        });
52
53 View Code Duplication
        Schema::create('TaskList_User', function (Blueprint $table) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across 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...
54
            $table->increments('id');
55
            $table->integer('tasklist')->unsigned();
56
            $table->integer('user')->unsigned();
57
58
            $table->foreign('tasklist')->references('id')->on('TaskList');
59
            $table->foreign('user')->references('id')->on('User');
60
        });
61
62
        Schema::create('TaskLog', function (Blueprint $table) {
63
            $table->increments('id');
64
            $table->integer('task')->unsigned();
65
            $table->tinyInteger('status');
66
            $table->timestamps();
67
            $table->softDeletes();
68
69
            $table->foreign('task')->references('id')->on('Task');
70
        });
71
72
    }
73
74
    /**
75
     * Reverse the migrations.
76
     *
77
     * @return void
78
     */
79
    public function down()
80
    {
81
82
        Schema::drop('Task');
83
        Schema::drop('TaskList');
84
        Schema::drop('Task_TaskList');
85
        Schema::drop('Task_User');
86
        Schema::drop('TaskList_User');
87
        Schema::drop('TaskLog');
88
89
    }
90
91
}
92