<?php
declare(strict_types=1);

return function (\App\Core\Database $db): void {
    $exists = $db->selectOne(
        "SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = 'members' AND column_name = 'ownership_transfer_date'"
    );
    if (!$exists) {
        $db->raw("ALTER TABLE members ADD COLUMN ownership_transfer_date DATE NULL DEFAULT NULL COMMENT 'Date membership ownership was transferred' AFTER activated_at");
    }
};
