<?php
declare(strict_types=1);

use Celena\Core\Database\Blueprint;
use Celena\Core\Database\Connection;
use Celena\Core\Database\Schema;

return function (Schema $schema, Connection $conn): void {
    $schema->create('celena_media', function (Blueprint $t) {
        $t->id();
        $t->string('filename', 255);
        $t->string('original_name', 255);
        $t->string('mime', 128);
        $t->integer('size');
        $t->integer('width')->nullable();
        $t->integer('height')->nullable();
        $t->string('path', 500);
        $t->string('url', 500);
        $t->bigInteger('uploaded_by')->nullable();
        $t->datetime('created_at')->nullable();
        $t->index('uploaded_by');
        $t->index('mime');
    });
};
