[
  {
    "type": "create_table",
    "description": "Create userNotificationPreferences table for granular notification settings",
    "database": "kiosk_users",
    "check_query": "SHOW TABLES LIKE 'userNotificationPreferences'",
    "sql": "CREATE TABLE `userNotificationPreferences` (\n  `prefId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `userId` int(10) unsigned NOT NULL COMMENT 'FK to users.id',\n  `typeNum` varchar(10) NOT NULL COMMENT 'Store-specific preferences',\n  `channel` enum('push','sms','email') NOT NULL COMMENT 'Notification delivery channel',\n  `category` enum('schedule_published','shift_changes','approvals','swap_requests','reminders') NOT NULL COMMENT 'Notification category',\n  `enabled` tinyint(1) NOT NULL DEFAULT 1 COMMENT 'Whether this notification is enabled',\n  `createdAt` timestamp NOT NULL DEFAULT current_timestamp(),\n  `updatedAt` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  PRIMARY KEY (`prefId`),\n  UNIQUE KEY `uk_user_store_channel_category` (`userId`, `typeNum`, `channel`, `category`),\n  KEY `idx_userId` (`userId`),\n  CONSTRAINT `fk_userNotificationPrefs_user` FOREIGN KEY (`userId`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='User notification preferences per store and category'"
  }
]
