<?php

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

class CreateTravelProgramDraftsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysql_stern')->create('travel_program_drafts', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('travel_program_id')->index();
            $table->unsignedInteger('travel_class_id')->index();
            $table->unsignedInteger('draft_id')->index();
            $table->string('weekdays');
            $table->timestamps();


        /*    $table->foreign('draft_id')
                ->references('id')
                ->on('drafts');
        */
            $table->foreign('travel_program_id')
                ->references('id')
                ->on('travel_program');

            $table->foreign('travel_class_id')
                ->references('id')
                ->on('travel_class');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysql_stern')->dropIfExists('travel_program_drafts');
    }
}
