<?php
declare(strict_types=1);
// ==================================================
// Nuclear Fancy Pants Edition™ -- NUCLEAR+++
// File: /home/ploi/automarketer-ai.com/public/wp-content/plugins/automarketer-ai/migrations/032_nudge_log_dismissed.php
// Description: Adds dismissed_at column to wp_amai_nudge_log - NUCLEAR+++
// Last Edited: 2026-05-13
// ==================================================
namespace AutoMarketerAI\Migrations;
defined('ABSPATH') || exit;
class Migration_032_NudgeLogDismissed
{
    public function up(): void
    {
        global $wpdb;
        $table  = $wpdb->prefix . 'amai_nudge_log';
        $column = $wpdb->get_var(
            $wpdb->prepare(
                "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = 'dismissed_at'",
                DB_NAME,
                $table
            )
        );
        if ($column !== null) {
            return;
        }
        $wpdb->query("ALTER TABLE `{$table}` ADD COLUMN dismissed_at DATETIME NULL DEFAULT NULL");
    }
}
