<?php
declare(strict_types=1);

return [
    'up' => function (\App\Core\Database $db): void {
        $exists = $db->selectOne(
            "SELECT 1 FROM information_schema.COLUMNS
              WHERE table_schema = DATABASE() AND table_name = 'transfer_requests' AND column_name = 'marriage_date'",
            []
        );
        if (!$exists) {
            $db->raw("ALTER TABLE transfer_requests ADD COLUMN marriage_date DATE NULL DEFAULT NULL AFTER work_date");
        }
    },
    'down' => "ALTER TABLE transfer_requests DROP COLUMN IF EXISTS marriage_date;",
];
