51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class CreateQueueItemsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('queue_items', function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->unsignedInteger('user_id');
|
|
$table->string('batch_reference')->nullable(true);
|
|
$table->string('action_type', 50);
|
|
$table->unsignedInteger('album_id');
|
|
$table->unsignedBigInteger('photo_id');
|
|
$table->dateTime('queued_at');
|
|
$table->dateTime('completed_at')->nullable(true);
|
|
$table->timestamps();
|
|
|
|
$table->foreign('user_id')
|
|
->references('id')->on('users')
|
|
->onDelete('cascade');
|
|
|
|
$table->foreign('album_id')
|
|
->references('id')->on('albums')
|
|
->onDelete('cascade');
|
|
|
|
$table->foreign('photo_id')
|
|
->references('id')->on('photos')
|
|
->onDelete('cascade');
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('queue_items');
|
|
}
|
|
}
|