Completed
Push — master ( 28b1a6...80a5d3 )
by Joao
02:18
created

CreateContactsTables::up()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 28
Code Lines 20

Duplication

Lines 22
Ratio 78.57 %
Metric Value
dl 22
loc 28
rs 8.8571
cc 1
eloc 20
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use \jlourenco\base\Database\Blueprint;
5
6
class CreateContactsTables 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('ContactType', 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('name', 100);
20
            $table->string('icon', 50)->nullable();
21
            $table->string('color_c', 6)->nullable();
22
            $table->string('color_hc', 6)->nullable();
23
            $table->string('description', 250);
24
            $table->timestamps();
25
            $table->softDeletes();
26
        });
27
28 View Code Duplication
        Schema::create('Contact', 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...
29
            $table->increments('id');
30
            $table->string('contact_reference', 50);
31
            $table->integer('contacttype')->unsigned();
32
            $table->string('contact', 250);
33
            $table->tinyInteger('visibility');
34
            $table->timestamps();
35
            $table->softDeletes();
36
            $table->creation();
37
38
            $table->foreign('contacttype')->references('id')->on('ContactType');
39
        });
40
41
    }
42
43
    /**
44
     * Reverse the migrations.
45
     *
46
     * @return void
47
     */
48
    public function down()
49
    {
50
51
        Schema::drop('Contact');
52
        Schema::drop('ContactType');
53
54
    }
55
56
}
57