| 1 | <?php |
||
| 6 | class CreateEventStore extends Migration |
||
|
|
|||
| 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() |
||
| 39 | } |
||
| 40 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.