CreateCustomfieldsTables::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 7
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
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('default_value', 250)->nullable();
22
            $table->string('type', 25);
23
            $table->binary('register');
24
            $table->binary('edit');
25
            $table->binary('mandatory');
26
            $table->binary('edit');
27
            $table->text("html");
28
            $table->string('entity', 100);
29
30
            $table->timestamps();
31
            $table->softDeletes();
32
            $table->creation();
33
        });
34
35
        Schema::create('CustomValue', function (Blueprint $table) {
36
            $table->increments('id');
37
            $table->integer('customfield')->unsigned();
38
            $table->string('value', 250)->nullable();
39
40
            $table->morphs("entity");
41
            $table->timestamps();
42
            $table->softDeletes();
43
            $table->creation();
44
45
            $table->foreign('customfield')->references('id')->on('CustomField');
46
        });
47
48
    }
49
50
    /**
51
     * Reverse the migrations.
52
     *
53
     * @return void
54
     */
55
    public function down()
56
    {
57
58
        Schema::drop('CustomValue');
59
        Schema::drop('CustomField');
60
61
    }
62
63
}
64