CreateEventStore::up()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 16
rs 9.4285
cc 2
eloc 11
nc 2
nop 0
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
6
class CreateEventStore 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...
7
{
8
    /**
9
     * Run the migrations.
10
     *
11
     * @return void
12
     */
13
    public function up()
14
    {
15
        if (!Schema::hasTable('event_store')) {
16
            Schema::create('event_store', function (Blueprint $table) {
17
                $table->increments('id');
18
                $table->string('identifier', 40);
19
                $table->unsignedInteger('sequence');
20
                $table->string('event', 100);
21
                $table->text('payload');
22
                $table->timestamps();
23
24
                $table->unique(['identifier', 'sequence'], 'entity_version');
25
                $table->index('identifier');
26
            });
27
        }
28
    }
29
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        // Event Store should never be deleted.
38
    }
39
}
40