<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('art_judicial_precedent', function (Blueprint $table) {
            $table->id();
            $table->foreignId('art_id')->constrained('art')->onDelete('cascade');
            $table->foreignId('judicial_precedent_id')->constrained('judicial_precedents')->onDelete('cascade');
            $table->timestamps();
            
            $table->unique(['art_id', 'judicial_precedent_id']);
        });
    }

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