[
  {
    "type": "create_table",
    "description": "Create pushNotificationQueue table for FCM push notification queuing",
    "database": "kiosk_users",
    "check_query": "SHOW TABLES LIKE 'pushNotificationQueue'",
    "sql": "CREATE TABLE `pushNotificationQueue` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `userId` int(10) unsigned NOT NULL COMMENT 'FK to users.id - notification recipient',\n  `typeNum` varchar(10) NULL COMMENT 'Store context if applicable (e.g., ou00)',\n  `notificationType` enum('schedule','clock','open_shift') NOT NULL COMMENT 'Type of notification',\n  `title` varchar(255) NOT NULL COMMENT 'Notification title',\n  `body` text NOT NULL COMMENT 'Notification body message',\n  `dataPayload` json NULL COMMENT 'Type-specific data: shift_id, date, etc.',\n  `priority` enum('high','normal') NOT NULL DEFAULT 'high' COMMENT 'FCM delivery priority',\n  `status` enum('pending','processing','sent','failed','cancelled') NOT NULL DEFAULT 'pending' COMMENT 'Queue status',\n  `attempts` int(10) unsigned NOT NULL DEFAULT 0 COMMENT 'Number of send attempts',\n  `maxAttempts` int(10) unsigned NOT NULL DEFAULT 3 COMMENT 'Maximum retry attempts',\n  `errorMessage` text NULL COMMENT 'Last error message if failed',\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'When notification was queued',\n  `sendAt` timestamp NULL COMMENT 'Scheduled send time (NULL for immediate)',\n  `sentAt` timestamp NULL COMMENT 'When notification was successfully sent',\n  PRIMARY KEY (`id`),\n  KEY `idx_status_sendAt` (`status`, `sendAt`),\n  KEY `idx_userId` (`userId`),\n  KEY `idx_createdAt` (`createdAt`),\n  CONSTRAINT `fk_pushNotificationQueue_user` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Queue for FCM push notifications'"
  }
]
