Completed
Push — master ( 8f2e40...7dcc71 )
by wen
02:45
created

CreateActionLogTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
B up() 0 29 1
A down() 0 4 1
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateActionLogTable 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...
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create(config('actionlog.table_name'), function (Blueprint $table) {
17
            $table->engine = "InnoDB COMMENT='用户操作记录表'";
18
19
            $table->increments('id');
20
21
            $table->integer('user_id')
22
                ->unsigned()
23
                ->comment('操作者ID');
24
25
            $table->string('type', 50)
26
                ->comment('操作类型');
27
28
            $table->string('content', 500)
29
                ->comment('操作描述');
30
31
            $table->string('ip', 20)
32
                ->comment('操作者IP');
33
34
            $table->timestamp('created_at')
35
                ->comment('操作时间');
36
37
            $table->index('user_id');
38
            $table->index('type');
39
            $table->index('created_at');
40
41
        });
42
    }
43
44
    /**
45
     * Reverse the migrations.
46
     *
47
     * @return void
48
     */
49
    public function down()
50
    {
51
        Schema::dropIfExists(config('actionlog.table_name'));
52
    }
53
}
54