<?php

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

class IsUploadComplete extends Migration
{
    const TABLE_CAPSULE = 'table_capsule';

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table(static::TABLE_CAPSULE, function (Blueprint $table) {

            $table->boolean('is_complete_upload')->nullable()->default(false);
            $table->index('is_complete_upload');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table(static::TABLE_CAPSULE, function (Blueprint $table) {

            $table->dropIndex(['is_complete_upload']);
            $table->dropColumn('is_complete_upload');
        });
    }
}
