CreateLinksTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 17
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Uccello\Core\Database\Migrations\Migration;
6
use Uccello\Core\Database\Migrations\Traits\TablePrefixTrait;
7
8
class CreateLinksTable extends Migration
9
{
10
    use TablePrefixTrait;
11
12
    /**
13
     * Run the migrations.
14
     *
15
     * @return void
16
     */
17
    public function up()
18
    {
19
        Schema::create($this->tablePrefix.'links', function(Blueprint $table) {
20
            $table->increments('id');
21
            $table->unsignedInteger('module_id');
22
            $table->string('label');
23
            $table->string('icon')->nullable();
24
            $table->string('type');
25
            $table->string('url')->nullable();
26
            $table->unsignedInteger('sequence');
27
            $table->text('data')->nullable();
28
            $table->timestamps();
29
30
            // Foreign keys
31
            $table->foreign('module_id')
32
                    ->references('id')->on($this->tablePrefix.'modules')
33
                    ->onDelete('cascade');
34
        });
35
    }
36
37
    /**
38
     * Reverse the migrations.
39
     *
40
     * @return void
41
     */
42
    public function down()
43
    {
44
        Schema::dropIfExists($this->tablePrefix.'links');
45
    }
46
}
47