[
  {
    "type": "create_table",
    "description": "Create goalConfigurations table for store goal settings (Spec 046)",
    "database": "kiosk_buykiosk",
    "check_query": "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'kiosk_buykiosk' AND TABLE_NAME = 'goalConfigurations'",
    "sql": "CREATE TABLE `goalConfigurations` (\n  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,\n  `storeId` INT UNSIGNED NOT NULL COMMENT 'FK to stores.id',\n  `typeNum` VARCHAR(10) NOT NULL COMMENT 'Store identifier',\n  `activeMethod` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '0=Prior Year, 1=Annual Target, 2=Monthly Calendar',\n  `methodSettings` JSON NOT NULL COMMENT 'All 3 methods parameters as JSON',\n  `hourlyTimeBands` JSON DEFAULT NULL COMMENT 'Manager time-band adjustments',\n  `updatedAt` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n  `updatedBy` INT UNSIGNED DEFAULT NULL COMMENT 'users.id who last updated',\n  PRIMARY KEY (`id`),\n  UNIQUE KEY `uk_storeId` (`storeId`),\n  UNIQUE KEY `uk_typeNum` (`typeNum`),\n  KEY `idx_activeMethod` (`activeMethod`)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Goal calculation configuration per store (Spec 046)'"
  }
]
