-- 门店首页模块配置落库：原仅存 Redis 的 modules/topNav/banner/navGrid/hot/new/pullGoods
-- 统一按门店(shopId)维度落一张通用配置表，moduleKey 区分具体模块，configValue 存 JSON

CREATE TABLE IF NOT EXISTS `xhHomePageModuleConfig` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mainId` int(11) NOT NULL DEFAULT 0 COMMENT '中央id',
  `shopId` int(11) NOT NULL DEFAULT 0 COMMENT '门店id',
  `moduleKey` varchar(32) NOT NULL DEFAULT '' COMMENT '配置项标识：modules/topNav/banner/navGrid/hot/new/pullGoods',
  `configValue` text COMMENT '配置内容JSON，结构随moduleKey而定',
  `addTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_shop_module` (`shopId`,`moduleKey`),
  KEY `mainId` (`mainId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='门店首页模块配置';
