<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('courses', function (Blueprint $table) {
            $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('courses', function (Blueprint $table) {
            $table->dropColumn('course_frequency_id');
            $table->dropColumn('course_level_id');
        });
    }
};
