已上

CREATE TABLE `xhGoodsUseCase` (
  `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',
  `sjId` int(11) NOT NULL DEFAULT 0 COMMENT '商家id',
  `useCaseName` varchar(50) NOT NULL DEFAULT '' COMMENT '场景名称',
  `inTurn` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态',
  `delStatus` tinyint(4) NOT NULL DEFAULT 0 COMMENT '删除状态',
  `addTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `mainId` (`mainId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='花束场景';

CREATE TABLE `xhGoodsUseCaseRelation` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mainId` int(11) NOT NULL DEFAULT 0,
  `goodsId` int(11) NOT NULL DEFAULT 0,
  `useCaseId` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  UNIQUE KEY `goods_use_case` (`goodsId`,`useCaseId`),
  KEY `mainId` (`mainId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='花束与场景关联表';




ALTER TABLE xhHd
  add COLUMN `homeRule` tinyint(4) NOT NULL DEFAULT '0' COMMENT '上门遵循规则 0遵循总设置 1遵循自定义' after `updateTime`,ALGORITHM=INPLACE, LOCK=NONE;


ALTER TABLE xhCustom
  add COLUMN `homeRule` tinyint(4) NOT NULL DEFAULT '0' COMMENT '上门遵循规则 0遵循总设置 1遵循自定义' after `updateTime`,ALGORITHM=INPLACE, LOCK=NONE;


-- 商品表添加索引
ALTER TABLE xhGoods ADD KEY `idx_m` (`masterId`);