<?php
declare(strict_types=1);

return function (\App\Core\Database $db): void {
    $tables = ['children', 'temporary_members'];

    foreach ($tables as $table) {
        $exists = $db->selectOne(
            "SELECT 1 FROM information_schema.columns WHERE table_schema = DATABASE() AND table_name = ? AND column_name = 'join_date'",
            [$table]
        );
        if (!$exists) {
            $db->raw("ALTER TABLE `{$table}` ADD COLUMN `join_date` DATE NULL AFTER `status`");
        }
    }
};
