<?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('shift_segment_days', function (Blueprint $table) {
            $table->id();
            $table->foreignId('shift_segment_id')->constrained()->cascadeOnDelete();
            $table->string('weekday'); // monday, tuesday...
            $table->foreignId('shift_id')->constrained()->cascadeOnDelete();
            $table->timestamps();

            $table->unique(['shift_segment_id', 'weekday']);
        });
    }

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

