<?php

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

class CreateTravelProgramCountryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysql_stern')->create('travel_program_country', function (Blueprint $table) {
            $table->increments('id');


            $table->integer('program_id')->nullable()->index();
            $table->integer('country_id')->nullable()->index();

            $table->foreign('program_id')
                ->references('id')
                ->on('travel_program');

            $table->foreign('country_id')
                ->references('id')
                ->on('travel_country');

        });
    }

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