<?php

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

class CreateBeliLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('beli_logs', function (Blueprint $table) {
          $table->increments('id');
          $table->integer('menu_id')->unsigned()->index();
          $table->foreign('menu_id')->references('id')->on('menus')
          ->onDelete('cascade')
          ->onUpdate('cascade');
          $table->integer('user_id')->unsigned()->index();
          $table->foreign('user_id')->references('id')->on('users')
          ->onDelete('cascade')
          ->onUpdate('cascade');
          $table->boolean('dibatalkan')->default(false);
          $table->timestamps();
        });
    }

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