Completed
Push — master ( 81bc36...e196e6 )
by Joao
02:28
created

CreateCustomfieldsTables   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 48
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 0 25 1
A down() 0 7 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use \jlourenco\base\Database\Blueprint;
5
6
class CreateCustomfieldsTables 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
        Schema::create('CustomField', function (Blueprint $table) {
18
            $table->increments('id');
19
            $table->string('title', 25);
20
            $table->string('friendly_name', 150);
21
            $table->string('value', 250)->nullable();
22
            $table->string('type', 25);
23
            $table->tinyinteger('visibility');
24
        });
25
26
        Schema::create('CustomValue', function (Blueprint $table) {
27
            $table->increments('id');
28
            $table->integer('customfield')->unsigned();
29
            $table->string('entity', 100);
30
            $table->integer('registry');
31
            $table->string('value', 250)->nullable();
32
            $table->timestamps();
33
            $table->softDeletes();
34
35
            $table->foreign('customfield')->references('id')->on('CustomField');
36
        });
37
38
    }
39
40
    /**
41
     * Reverse the migrations.
42
     *
43
     * @return void
44
     */
45
    public function down()
46
    {
47
48
        Schema::drop('CustomValue');
49
        Schema::drop('CustomField');
50
51
    }
52
53
}
54