<?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
    {
        if (! Schema::hasTable('tour_media')) {
            Schema::create('tour_media', function (Blueprint $table) {
                $table->increments('id');
                $table->enum('kind', ['image', 'video']);
                $table->string('disk', 40)->default('local');
                $table->string('path', 255);            // relative path on the private disk
                $table->string('mime', 100)->nullable();
                $table->string('original_name', 255)->nullable();
                $table->unsignedBigInteger('size')->nullable();
                $table->timestamps();
            });
        }
    }

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