Passed
Pull Request — master (#1)
by
unknown
07:50
created

CreateAuditsTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 15
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 18
rs 9.7666
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateAuditsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('audits', function (Blueprint $table) {
17
            $table->bigIncrements('id');
18
            $table->uuid('uuid')->default('-');
19
            $table->string('user_type')->nullable();
20
            $table->unsignedBigInteger('user_id')->nullable();
21
            $table->string('event');
22
            $table->morphs('auditable');
23
            $table->text('old_values')->nullable();
24
            $table->text('new_values')->nullable();
25
            $table->text('url')->nullable();
26
            $table->ipAddress('ip_address')->nullable();
27
            $table->string('user_agent', 1023)->nullable();
28
            $table->string('tags')->nullable();
29
            $table->timestamps();
30
31
            $table->index(['user_id', 'user_type']);
32
        });
33
    }
34
35
    /**
36
     * Reverse the migrations.
37
     *
38
     * @return void
39
     */
40
    public function down()
41
    {
42
        Schema::drop('audits');
43
    }
44
}
45