<?php
declare(strict_types=1);
// ==================================================
// Nuclear Fancy Pants Edition™ -- NUCLEAR+++
// File: /migrations/041_competitor_urls.php
// Description: Creates wp_amai_competitor_urls table for saved competitor gap URLs - NUCLEAR+++
// Last Edited: 2026-05-18
// ==================================================
namespace AutoMarketerAI\Migrations;
defined('ABSPATH') || exit;
final class Migration_041_CompetitorUrls
{
    public function up(): void
    {
        global $wpdb;
        $charset = $wpdb->get_charset_collate();
        $wpdb->query(
            "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}amai_competitor_urls` (" .
            "  `id`               INT UNSIGNED NOT NULL AUTO_INCREMENT," .
            "  `url`              VARCHAR(512) NOT NULL DEFAULT ''," .
            "  `label`            VARCHAR(255) NOT NULL DEFAULT ''," .
            "  `last_analyzed_at` DATETIME     NULL DEFAULT NULL," .
            "  `created_at`       DATETIME     NOT NULL DEFAULT CURRENT_TIMESTAMP," .
            "  PRIMARY KEY (`id`)," .
            "  UNIQUE KEY `uq_url` (`url`(255))" .
            ") {$charset}"
        );
    }
}