<?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::table('calendars', function (Blueprint $table) {
            $table->string('name')->nullable();
            $table->unsignedBigInteger('course_type_id')->nullable();
            $table->foreign('course_type_id')->nullable()->references('id')->on('course_types')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('course_duration_id')->nullable();
            $table->foreign('course_duration_id')->nullable()->references('id')->on('course_durations')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('course_frequency_id')->nullable();
            $table->foreign('course_frequency_id')->nullable()->references('id')->on('course_frequencies')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('course_level_id')->nullable();
            $table->foreign('course_level_id')->nullable()->references('id')->on('course_levels')->onUpdate('cascade')->onDelete('cascade');
            
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('calendars', function (Blueprint $table) {
            $table->dropColumn('name');
            $table->dropColumn('course_type_id');
            $table->dropColumn('course_duration_id');
            $table->dropColumn('course_frequency_id');
            $table->dropColumn('course_level_id');
        });
    }
};
