<?php

use App\Models\Polymorphs\Media;
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((new Media)->getTable(), function (Blueprint $table) {
            $table->bigIncrements('id');

            //$table->nullableUlidMorphs("model");
            $table->string("model_id", 100)
                ->nullable()
                ->comment("[polymoph_id] l'id du model (l'idenfinat d'une ligne dans une table quelconque)  (ex : '1')");
            $table->string("model_type")
                ->nullable()
                ->comment("[polymoph_type] le type du model (le nom de cette table utilisé par laravel)
                  pour faire la correspondance de l'enregistrement  (ex : 'user')");

            $table->uuid('uuid')->nullable()->unique();
            $table->string('collection_name');
            $table->string('name');
            $table->string('file_name');
            $table->string('mime_type')->nullable();
            $table->string('disk');
            $table->string('conversions_disk')->nullable();
            $table->unsignedBigInteger('size');
            $table->json('manipulations');
            $table->json('custom_properties');
            $table->json('generated_conversions');
            $table->json('responsive_images');
            $table->unsignedInteger('order_column')->nullable()->index();

            $table->nullableTimestamps();
        });
    }

};
