[
  {
    "type": "create_table",
    "description": "Create fpLayouts table - layout versions (current and scheduled wanted layouts)",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'fpLayouts'",
    "sql": "CREATE TABLE `fpLayouts` (\n  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n  `floorPlanId` INT UNSIGNED NOT NULL COMMENT 'FK to fpFloorPlans',\n  `name` VARCHAR(100) NOT NULL COMMENT 'e.g., Holiday 2025, Summer Sale',\n  `description` TEXT NULL,\n  `layoutType` ENUM('current','wanted') DEFAULT 'wanted',\n  `status` ENUM('draft','scheduled','active','archived') DEFAULT 'draft',\n  `activationDate` DATE NULL COMMENT 'When wanted layout becomes current',\n  `eventId` INT UNSIGNED NULL COMMENT 'FK to events table (if linked)',\n  `draftOfLayoutId` INT UNSIGNED NULL COMMENT 'If set, this layout is a draft of the referenced layout',\n  `activated_at` TIMESTAMP NULL COMMENT 'When layout became active',\n  `archived_at` TIMESTAMP NULL,\n  `createdBy` INT UNSIGNED NULL COMMENT 'FK to kiosk_users.users.id (no FK constraint in store DB)',\n  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n  `updated_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`),\n  INDEX `idx_floorPlanId` (`floorPlanId`),\n  INDEX `idx_status` (`status`),\n  INDEX `idx_layoutType` (`layoutType`),\n  INDEX `idx_activationDate` (`activationDate`),\n  INDEX `idx_eventId` (`eventId`),\n  INDEX `idx_draftOfLayoutId` (`draftOfLayoutId`),\n  CONSTRAINT `fk_fpLayouts_floorPlanId` FOREIGN KEY (`floorPlanId`) REFERENCES `fpFloorPlans`(`id`) ON DELETE CASCADE,\n  CONSTRAINT `fk_fpLayouts_draftOfLayoutId` FOREIGN KEY (`draftOfLayoutId`) REFERENCES `fpLayouts`(`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Layout versions - current and scheduled wanted layouts'"
  },
  {
    "type": "create_table",
    "description": "Create fpSocketAssignments table - category assignments to sockets",
    "database": "{{store}}",
    "check_query": "SHOW TABLES LIKE 'fpSocketAssignments'",
    "sql": "CREATE TABLE `fpSocketAssignments` (\n  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n  `layoutId` INT UNSIGNED NOT NULL COMMENT 'FK to fpLayouts',\n  `socketId` INT UNSIGNED NOT NULL COMMENT 'FK to fpRackSockets',\n  `subcategoryCode` VARCHAR(10) NOT NULL COMMENT 'POS subcategory code',\n  `sortOrder` INT UNSIGNED DEFAULT 0 COMMENT 'Order within socket',\n  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n  PRIMARY KEY (`id`),\n  INDEX `idx_layoutId` (`layoutId`),\n  INDEX `idx_socketId` (`socketId`),\n  INDEX `idx_subcategoryCode` (`subcategoryCode`),\n  UNIQUE KEY `uk_layout_socket_subcategory` (`layoutId`, `socketId`, `subcategoryCode`),\n  CONSTRAINT `fk_fpSocketAssignments_layoutId` FOREIGN KEY (`layoutId`) REFERENCES `fpLayouts`(`id`) ON DELETE CASCADE,\n  CONSTRAINT `fk_fpSocketAssignments_socketId` FOREIGN KEY (`socketId`) REFERENCES `fpRackSockets`(`id`) ON DELETE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Category assignments to sockets for a specific layout'"
  }
]
