[
  {
    "type": "create_table",
    "description": "Create seller marketing global message queue table",
    "database": "kiosk_buykiosk",
    "check_query": "SHOW TABLES LIKE 'seller_marketing_queue'",
    "sql": "CREATE TABLE `seller_marketing_queue` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `store_id` int(10) unsigned NOT NULL COMMENT 'References stores.id',\n  `phone` varchar(15) NOT NULL COMMENT 'Recipient phone number (10 digits)',\n  `message` text NOT NULL COMMENT 'SMS message content',\n  `message_type` enum('trigger','blast') NOT NULL COMMENT 'Type of message',\n  `trigger_id` int(10) unsigned DEFAULT NULL COMMENT 'ID of trigger that generated this message (if applicable)',\n  `blast_id` int(10) unsigned DEFAULT NULL COMMENT 'ID of blast that generated this message (if applicable)',\n  `created_at` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'When message was queued',\n  `send_at` timestamp NOT NULL COMMENT 'When message should be sent',\n  `sent_at` timestamp NULL DEFAULT NULL COMMENT 'When message was actually sent',\n  `status` enum('pending','sent','failed','cancelled') NOT NULL DEFAULT 'pending' COMMENT 'Message status',\n  `provider` enum('vonage','twilio') NOT NULL COMMENT 'SMS provider to use',\n  `provider_id` varchar(255) DEFAULT NULL COMMENT 'Provider message ID',\n  `error_message` text DEFAULT NULL COMMENT 'Error details if failed',\n  `attempts` tinyint(3) unsigned NOT NULL DEFAULT 0 COMMENT 'Number of send attempts',\n  `max_attempts` tinyint(3) unsigned NOT NULL DEFAULT 3 COMMENT 'Maximum retry attempts',\n  `priority` tinyint(3) unsigned NOT NULL DEFAULT 5 COMMENT 'Message priority (1=highest, 10=lowest)',\n  PRIMARY KEY (`id`),\n  KEY `idx_store_status` (`store_id`,`status`),\n  KEY `idx_send_at` (`send_at`),\n  KEY `idx_phone` (`phone`),\n  KEY `idx_status_attempts` (`status`,`attempts`),\n  KEY `idx_created_at` (`created_at`),\n  KEY `idx_provider` (`provider`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Global outgoing message queue for seller marketing'"
  }
]