[
  {
    "type": "create_table",
    "description": "Create seller marketing triggers table",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'seller_marketing_triggers'",
    "sql": "CREATE TABLE `seller_marketing_triggers` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `name` varchar(255) NOT NULL COMMENT 'Display name for the trigger',\n  `type` enum('days_since_event','days_since_sold','birthday','expiring_points','custom') NOT NULL COMMENT 'Type of trigger',\n  `message_id` int(10) unsigned NOT NULL COMMENT 'References seller_marketing_messages.id',\n  `status` enum('active','inactive','expired') NOT NULL DEFAULT 'active' COMMENT 'Trigger status',\n  `config` json NOT NULL COMMENT 'Trigger configuration parameters',\n  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),\n  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  `expire_date` date DEFAULT NULL COMMENT 'When trigger should stop running',\n  `last_processed` timestamp NULL DEFAULT NULL COMMENT 'Last time trigger was processed',\n  `processing_frequency` enum('hourly','daily','weekly') NOT NULL DEFAULT 'daily' COMMENT 'How often to check trigger',\n  `time_frame` time DEFAULT NULL COMMENT 'What time of day to send messages',\n  `time_random` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Send at random time',\n  `active_days` set('monday','tuesday','wednesday','thursday','friday','saturday','sunday') DEFAULT 'monday,tuesday,wednesday,thursday,friday,saturday,sunday' COMMENT 'Days trigger is active',\n  PRIMARY KEY (`id`),\n  KEY `idx_status_type` (`status`,`type`),\n  KEY `idx_message_id` (`message_id`),\n  KEY `idx_last_processed` (`last_processed`),\n  KEY `idx_expire_date` (`expire_date`),\n  CONSTRAINT `fk_trigger_message` FOREIGN KEY (`message_id`) REFERENCES `seller_marketing_messages` (`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Automated trigger configurations'"
  }
]