<?php

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

return new class extends TenantMigration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('calendars', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('course_id')->nullable();
            $table->foreign('course_id')->nullable()->references('id')->on('courses')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('court_id')->nullable();
            $table->foreign('court_id')->nullable()->references('id')->on('courts')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('instructor_id')->nullable();
            $table->foreign('instructor_id')->nullable()->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade');
            $table->datetime('date')->nullable();
            $table->string('from')->nullable();
            $table->string('to')->nullable();
            $table->string('note')->nullable();
            $table->softDeletes();
            $table->timestamps();
        });
    }

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