<?php

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

class CreateCreditTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
         Schema::create('credit', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('credit');
            $table->string('name');
            $table->string('type');
            $table->integer('shift');
            
            $table->integer('schedule_id')->unsigned()->index();
            $table->foreign('schedule_id')->references('id')->on('schedule')->onDelete('cascade'); 

            $table->integer('festive_id')->unsigned()->index();
            $table->foreign('festive_id')->references('id')->on('festive')->onDelete('cascade'); 
           
            $table->softDeletes();
            $table->timestamps();
		});
    }

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