[
  {
    "type": "create_table",
    "description": "Create employeeScheduleSmsLog table for SMS rate limiting (global per user)",
    "database": "kiosk_users",
    "check_query": "SHOW TABLES LIKE 'employeeScheduleSmsLog'",
    "sql": "CREATE TABLE `employeeScheduleSmsLog` (\n  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `userId` int(10) unsigned NOT NULL COMMENT 'FK to kiosk_users.users.id',\n  `sentDate` date NOT NULL COMMENT 'UTC date for rate limiting',\n  `sentAt` datetime NOT NULL DEFAULT current_timestamp() COMMENT 'When the SMS was sent (UTC)',\n  `messageType` varchar(50) DEFAULT NULL COMMENT 'Type of message: schedule_published, request_approved, etc.',\n  PRIMARY KEY (`id`),\n  KEY `idx_user_date` (`userId`, `sentDate`),\n  KEY `idx_sentAt` (`sentAt`),\n  CONSTRAINT `fk_employeeScheduleSmsLog_user` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='SMS rate limiting log for schedule notifications'"
  }
]
