<?php
declare(strict_types=1);

namespace App\Domain\User\Migrations;

use App\Framework\Database\ConnectionInterface;
use App\Framework\Database\Migration\Migration;

final readonly class CreateUsersTable implements Migration
{

    public function up(ConnectionInterface $connection): void
    {
        $connection->query("CREATE TABLE IF NOT EXISTS users (
                                id INTEGER PRIMARY KEY AUTOINCREMENT,
                                ulid BINARY(16) NOT NULL UNIQUE,
                                name VARCHAR(255) NOT NULL
                                 )"
        );
    }

    public function down(ConnectionInterface $connection): void
    {
        $connection->query("DROP TABLE users");
    }

    public function getVersion(): string
    {
        return "001";
    }

    public function getDescription(): string
    {
        return "Create Users Table";
    }
}
