<?php

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

class Dismiss extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('alert_displays', function (Blueprint $table) {
            
            // Indexing speeds things up...
            $table->index('alert_id');
            $table->index('user_id');

            // Allow dismissing
            $table->tinyInteger('dismissed');

            // Add PK for Laravellic purposes
            $table->id();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('alert_displays', function (Blueprint $table) {
            $table->dropIndex('alert_id');
            $table->dropIndex('user_id');

            $table->dropColumn('dismissed');
            $table->dropColumn('id');
        });
    }
}
