<?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('presences', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('calendar_id')->nullable();
            $table->foreign('calendar_id')->nullable()->references('id')->on('calendars')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('member_id')->nullable();
            $table->foreign('member_id')->nullable()->references('id')->on('members')->onUpdate('cascade')->onDelete('cascade');
            $table->unsignedBigInteger('member_course_id')->nullable();
            $table->foreign('member_course_id')->nullable()->references('id')->on('member_courses')->onUpdate('cascade')->onDelete('cascade');

            $table->softDeletes();
            $table->timestamps();
        });
    }

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