<?php

declare(strict_types=1);

namespace App\Domain\Media\Migrations;

use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;
use App\Framework\Database\Migration\MigrationVersion;
use App\Framework\Database\Schema\Blueprint;
use App\Framework\Database\Schema\Schema;

final readonly class AddSizeToImageVariantsTable implements Migration
{
    public function up(ConnectionInterface $connection): void
    {
        $schema = new Schema($connection);

        $schema->table('image_variants', function (Blueprint $table) {
            $table->string('size', 25)->default('');
        });

        $schema->execute();
    }

    public function down(ConnectionInterface $connection): void
    {
        $schema = new Schema($connection);

        $schema->table('image_variants', function (Blueprint $table) {
            $table->dropColumn('size');
        });

        $schema->execute();
    }

    public function getVersion(): MigrationVersion
    {
        return MigrationVersion::fromTimestamp("2024_01_17_000004");
    }

    public function getDescription(): string
    {
        return "Add Size to Image Slot Table";
    }
}
