CreateMetricsAnalysersTables::up()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 85

Duplication

Lines 27
Ratio 31.76 %

Importance

Changes 0
Metric Value
dl 27
loc 85
rs 8.3272
c 0
b 0
f 0
cc 1
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
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateMetricsAnalysersTables extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        // @todo Falta fazer aqui 
17
        
18
        Schema::create(
19
            'metric_result_types', function (Blueprint $table) {
20
                $table->engine = 'InnoDB';
21
                $table->increments('id')->unsigned();
22
                $table->string('name', 255)->nullable();
23
                $table->string('type', 255)->nullable(); //(int, decimal)
24
                // $table->string('tatuageable_id');
25
                // $table->string('tatuageable_type', 255);
26
                $table->timestamps();
27
                $table->softDeletes();
28
            }
29
        );
30
31
32
33
        /**
34
         * 
35
         */
36
        
37
        Schema::create(
38 View Code Duplication
            'metrics', 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...
39
                $table->engine = 'InnoDB';
40
                $table->increments('id')->unsigned();
41
                $table->longText('text')->nullable();
42
                // $table->string('tatuageable_id');
43
                // $table->string('tatuageable_type', 255);
44
                $table->timestamps();
45
                $table->softDeletes();
46
            }
47
        );
48
49
        Schema::create(
50 View Code Duplication
            'metric_analyses', 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...
51
                $table->engine = 'InnoDB';
52
                $table->increments('id')->unsigned();
53
                $table->longText('text')->nullable();
54
                // $table->string('tatuageable_id');
55
                // $table->string('tatuageable_type', 255);
56
                $table->timestamps();
57
                $table->softDeletes();
58
            }
59
        );
60
        
61
        Schema::create(
62 View Code Duplication
            'metric_analyse_results', 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...
63
                $table->engine = 'InnoDB';
64
                $table->increments('id')->unsigned();
65
                $table->longText('text')->nullable();
66
                // $table->string('tatuageable_id');
67
                // $table->string('tatuageable_type', 255);
68
                $table->timestamps();
69
                $table->softDeletes();
70
            }
71
        );
72
        // ^ array:2 [
73
        //     "Targets" => array:2 [
74
        //       "File" => 272
75
        //       "Directory" => 100
76
        //     ]
77
        //     "Extensions" => array:3 [
78
        //       "Json" => 5
79
        //       "Php" => 245
80
        //       "Md" => 2
81
        //     ]
82
        //   ]
83
          
84
85
        Schema::create(
86
            'analyser_results', function (Blueprint $table) {
87
                $table->increments('id');
88
                $table->string('name');
89
                $table->string('md5_name');
90
                $table->string('result');
91
                $table->string('md5_result');
92
                $table->integer('status');
93
                $table->string('reference_id')->nullable();
94
                $table->string('bot_runner_id');
95
                $table->timestamps();
96
            }
97
        );
98
    }
99
    /**
100
     * Reverse the migrations.
101
     *
102
     * @return void
103
     */
104
    public function down()
105
    {
106
        Schema::dropIfExists('analyser_results');
107
    }
108
}
109