<?php

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

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

            $table->foreignId('order_id');
            $table->foreignId('employee_id');
            $table->foreignId('jobstatus');

            $table->dateTime('dateTime', 0);

            $table->boolean('isCompleted')->default(0);

            $table->dateTime('completingperiod', 0);


            $table->foreign('order_id')->references('id')->on('orders');
            $table->foreign('employee_id')->references('id')->on('employees');
            $table->foreign('jobstatus')->references('id')->on('statuses');

            $table->timestamps();
        });
    }

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