Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Test Setup Failed
Pull Request — master (#4161)
by
unknown
15:22
created

CreatePivotableRelationsTables::up()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 85
Code Lines 59

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 59
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 85
rs 8.8945

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\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreatePivotableRelationsTables extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('comments', function (Blueprint $table) {
17
            $table->bigIncrements('id');
18
            $table->string('text')->nullable();
19
            $table->morphs('commentable');
20
            $table->timestamps();
21
        });
22
23
        Schema::create('recommendables', function (Blueprint $table) {
24
            $table->bigIncrements('id');
25
            $table->string('text')->nullable();
26
            $table->morphs('recommendable');
27
            $table->bigInteger('recommend_id');
28
            $table->timestamps();
29
        });
30
31
        Schema::create('billables', function (Blueprint $table) {
32
            $table->bigIncrements('id');
33
            $table->string('text')->nullable();
34
            $table->morphs('billable');
35
            $table->bigInteger('bill_id');
36
            $table->timestamps();
37
        });
38
39
        Schema::create('articles_user', function (Blueprint $table) {
40
            $table->increments('id');
41
            $table->integer('article_id')->unsigned();
42
            $table->integer('user_id')->unsigned();
43
            $table->string('notes');
44
            $table->nullableTimestamps();
45
        });
46
47
        Schema::create('recommends', function (Blueprint $table) {
48
            $table->bigIncrements('id');
49
            $table->string('title')->nullable();
50
            $table->timestamps();
51
        });
52
53
        Schema::create('bills', function (Blueprint $table) {
54
            $table->bigIncrements('id');
55
            $table->string('title')->nullable();
56
            $table->timestamps();
57
        });
58
59
        Schema::create('stars', function (Blueprint $table) {
60
            $table->bigIncrements('id');
61
            $table->string('starable_type');
62
            $table->bigInteger('starable_id');
63
            $table->string('title')->nullable();
64
        });
65
66
        Schema::create('universes', function (Blueprint $table) {
67
            $table->bigIncrements('id');
68
            $table->bigInteger('user_id');
69
            $table->string('title')->nullable();
70
        });
71
72
        Schema::create('planets', function (Blueprint $table) {
73
            $table->bigIncrements('id');
74
            $table->bigInteger('user_id')->nullable();
75
            $table->string('title')->nullable();
76
        });
77
78
        Schema::create('comets', function (Blueprint $table) {
79
            $table->bigIncrements('id');
80
            $table->bigInteger('user_id')->default(0);
81
        });
82
83
        Schema::create('bangs', function (Blueprint $table) {
84
            $table->bigIncrements('id');
85
            $table->string('name');
86
        });
87
88
        Schema::create('account_details_bang', function (Blueprint $table) {
89
            $table->bigIncrements('id');
90
            $table->bigInteger('account_details_id');
91
            $table->bigInteger('bang_id');
92
        });
93
94
        Schema::create('account_details_bangs_pivot', function (Blueprint $table) {
95
            $table->bigIncrements('id');
96
            $table->bigInteger('account_details_id');
97
            $table->bigInteger('bang_id');
98
            $table->string('pivot_field');
99
        });
100
    }
101
102
    public function down()
103
    {
104
        Schema::dropIfExists('recommendables');
105
        Schema::dropIfExists('comments');
106
        Schema::dropIfExists('recommends');
107
        Schema::dropIfExists('stars');
108
        Schema::dropIfExists('billables');
109
        Schema::dropIfExists('bills');
110
        Schema::dropIfExists('articles_users');
111
        Schema::dropIfExists('planets');
112
        Schema::dropIfExists('universes');
113
        Schema::dropIfExists('comets');
114
        Schema::dropIfExists('account_details_bang');
115
        Schema::dropIfExists('bangs');
116
        Schema::dropIfExists('account_details_bangs_pivot');
117
    }
118
}
119