<?php

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

class CreateProfessionalAppointmentConfigsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('professional_appointment_configs', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('professional_id')->unsigned();
            $table->string('interval_time');
            $table->integer('day_before_appointment');
            $table->boolean('allow_cancellation')->default(0);
            $table->timestamps();
        });

        Schema::table('professional_appointment_configs', function ($table) {
            $table->foreign('professional_id')->references('id')->on('users');
        });
    }

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