<?php
/**
 * Ensure members.created_by / members.updated_by exist (for mobile data collection & audit).
 * Safe to call multiple times.
 */
function ensureMembersAuditColumns(PDO $pdo): void {
    try {
        $pdo->exec('ALTER TABLE members ADD COLUMN created_by INT NULL DEFAULT NULL');
    } catch (Throwable $e) {
        // column may already exist
    }
    try {
        $pdo->exec('ALTER TABLE members ADD COLUMN updated_by INT NULL DEFAULT NULL');
    } catch (Throwable $e) {
        // column may already exist
    }
}
