<?php

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

class CreateActivitiesAttendedsTable extends Migration
{

    // Updated Migration
    public function up()
    {
        Schema::create('activities_attendeds', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->string('organising_institute'); 
            $table->text('address'); 
            $table->unsignedBigInteger('department_id'); 
            $table->unsignedBigInteger('faculty_id');
            $table->dateTime('start_date'); 
            $table->dateTime('end_date');   
            $table->integer('num_days'); 
            $table->string('activity_type');
            $table->string('category'); 
            $table->string('level'); 
            $table->string('proof')->nullable();
            $table->foreign('faculty_id')->references('id')->on('users')->onDelete('cascade');
            $table->foreign('department_id')->references('id')->on('departments')->onDelete('cascade');
            $table->timestamps();
        });
    }


    public function down()
    {
        Schema::dropIfExists('activities_attendeds');
    }
}
