<?php

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

class CreateShippingArrangementsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('shipping_arrangements', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('packing_list_id')->unsigned()->index();
            $table->integer('type')->default(0);
            $table->string('container_no');
            $table->string('seal_no');
            $table->date('shipped');
            $table->date('arrived');
            $table->timestamps();

            $table->foreign('packing_list_id')->references('id')->on('packing_lists');
        });
    }

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