<?php

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

class AddIsInvoiceGeneratedToBookingsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('bookings', function (Blueprint $table) {
            $table->boolean('is_invoice_generated')
                ->default(false)
                ->after('status');

            $table->index('is_invoice_generated', 'bookings_is_invoice_generated_index');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('bookings', function (Blueprint $table) {
            $table->dropIndex('bookings_is_invoice_generated_index');
            $table->dropColumn('is_invoice_generated');
        });
    }
}
