[
  {
    "type": "create_table",
    "description": "Create scheduleTemplates table for storing schedule templates",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'scheduleTemplates'",
    "sql": "CREATE TABLE `scheduleTemplates` (\n  `templateId` int(10) unsigned NOT NULL AUTO_INCREMENT,\n  `name` varchar(100) NOT NULL COMMENT 'Template name (unique per store)',\n  `description` text DEFAULT NULL COMMENT 'Optional template description',\n  `shiftCount` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Number of shifts in template',\n  `createdByUserId` int(10) unsigned NOT NULL COMMENT 'FK to kiosk_users.users.id (central user ID)',\n  `created_at` timestamp NOT NULL DEFAULT current_timestamp(),\n  `updated_at` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),\n  `lastUsedAt` timestamp NULL DEFAULT NULL COMMENT 'Last time this template was loaded',\n  PRIMARY KEY (`templateId`),\n  UNIQUE KEY `uk_name` (`name`),\n  KEY `idx_created_by` (`createdByUserId`),\n  KEY `idx_last_used` (`lastUsedAt` DESC)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Schedule templates for weekly schedule patterns'"
  }
]
