<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateFeedItemStatesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('feed_item_states', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('user_id')->index('feed_item_states_user_id_foreign');
            $table->unsignedBigInteger('document_id')->index('feed_item_states_document_id_foreign');
            $table->unsignedBigInteger('feed_id')->index('feed_item_states_feed_id_foreign');
            $table->unsignedBigInteger('feed_item_id')->index('feed_item_states_feed_item_id_foreign');
            $table->tinyInteger('is_read')->default(0);
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('feed_item_states');
    }
}
