<?php

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

return new class extends Migration
{
    public function up(): void
{
    Schema::create('docente_grupo', function (Blueprint $table) {
        $table->unsignedBigInteger('docente_id');
        $table->unsignedBigInteger('grupo_id');
        $table->unsignedBigInteger('materia_id');

        $table->foreign('docente_id')->references('id')->on('docentes');
        $table->foreign('grupo_id')->references('id')->on('grupos');
        $table->foreign('materia_id')->references('id')->on('materials');

        $table->unique(['docente_id', 'grupo_id', 'materia_id']);
    });
}

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