CreateChanges   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 48
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 30 1
A down() 0 4 1
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateChanges extends Migration
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        Schema::create(
16
            'changes', function ($table) {
17
                $table->engine = 'InnoDB';
18
                $table->increments('id');
19
20
                $table->string('model');
21
                $table->string('key');
22
                $table->string('action');
23
                $table->string('title')->nullable();
24
                $table->longText('changed')->nullable();
25
26
                $table->longText('meta')->nullable();
27
                $table->boolean('deleted')->nullable();
28
                $table->timestamps();
29
30
                $table->index(['model', 'key']);
31
                $table->index(['key', 'model']);
32
                $table->index(['action', 'created_at']);
33
                $table->index(['created_at', 'action']);
34
                $table->index(['deleted', 'created_at']);
35
36
                $table->integer('changeable_id')->nullable();
37
                $table->string('changeable_type', 255)->nullable();
38
                // $table->foreign('admin_id')->references('id')->on('admins')->onUpdate('cascade')->onDelete('cascade');
39
                // $table->integer('admin_id')->unsigned();
40
            }
41
        );
42
    }
43
44
    /**
45
     * Reverse the migrations.
46
     *
47
     * @return void
48
     */
49
    public function down()
50
    {
51
        Schema::dropIfExists('changes');
52
    }
53
}
54