Completed
Pull Request — master (#372)
by Mike
31:01 queued 16:07
created

CreateActionEventsTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 22 1
A down() 0 4 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateActionEventsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('action_events', function (Blueprint $table) {
17
            $table->id();
18
            $table->char('batch_id', 36);
19
            $table->unsignedBigInteger('user_id')->index();
20
            $table->string('name');
21
            $table->string('actionable_type');
22
            $table->unsignedBigInteger('actionable_id');
23
            $table->string('target_type');
24
            $table->unsignedBigInteger('target_id');
25
            $table->string('model_type');
26
            $table->unsignedBigInteger('model_id')->nullable();
27
            $table->text('fields');
28
            $table->string('status', 25)->default('running');
29
            $table->text('exception');
30
            $table->timestamps();
31
32
            $table->index(['actionable_type', 'actionable_id']);
33
            $table->index(['batch_id', 'model_type', 'model_id']);
34
        });
35
    }
36
37
    /**
38
     * Reverse the migrations.
39
     *
40
     * @return void
41
     */
42
    public function down()
43
    {
44
        Schema::dropIfExists('action_events');
45
    }
46
}
47