<?php

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

class CreateContract extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('contracts', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('client_id')->unsigned();
            $table->integer('professional_id')->unsigned();
            $table->integer('booking_id')->unsigned();
            $table->integer('proposal_id')->unsigned();
            $table->uuid('uuid');
            $table->timestamps();
        });
        Schema::table('contracts', function ($table) {
            $table->foreign('client_id')->references('id')->on('users');
            $table->foreign('professional_id')->references('id')->on('professionals');
            $table->foreign('booking_id')->references('id')->on('bookings');
            $table->foreign('proposal_id')->references('id')->on('proposals');

        });
    }

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