<?php

namespace App\Domain\Contact\Migrations;

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

final readonly class CreateContactTable implements Migration
{

    public function up(ConnectionInterface $connection): void
    {
        $sql = <<<SQL
        CREATE TABLE IF NOT EXISTS contacts (
            id INT AUTO_INCREMENT PRIMARY KEY,
            name VARCHAR(255) NOT NULL,
            email VARCHAR(255) NOT NULL,
            message TEXT NOT NULL
        )
SQL;
        $connection->execute($sql);
    }

    public function down(ConnectionInterface $connection): void
    {
        $connection->execute('DROP TABLE IF EXISTS contacts');
    }

    public function getVersion(): string
    {
        return '005';
    }

    public function getDescription(): string
    {
        return 'Create contact table';
    }
}
