<?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('subtitles', function (Blueprint $table) {
            $table->id();
            $table->string('subtitleable_type');
            $table->unsignedBigInteger('subtitleable_id');
            $table->string('label', 100);
            $table->string('language_code', 10)->nullable();
            $table->string('file_path');
            $table->timestamps();

            $table->index(['subtitleable_type', 'subtitleable_id']);
        });
    }

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