/****
    hive2.0改版sql变更
 */


ALTER TABLE  `shopping_goods`
ADD COLUMN `GOODS_NO` varchar(100) NULL COMMENT '存货编号(条形码)' AFTER `code`,
ADD COLUMN `unit` varchar(20) NULL COMMENT '单位' AFTER `GOODS_NO`,
ADD COLUMN `goods_sort_id` bigint(10) NULL COMMENT '存货分类' AFTER `unit`,
ADD COLUMN `supplier_id` bigint(10) NULL COMMENT '往来单位id' AFTER `goods_sort_id`,
ADD COLUMN `measure` varchar(5) NULL COMMENT '计量单位' AFTER `supplier_id`,
ADD COLUMN `alarm_num` double(20, 0) NULL COMMENT '预警数量' AFTER `measure`,
ADD COLUMN `volume` double(20, 0) NULL COMMENT '容积' AFTER `alarm_num`,
ADD COLUMN `price` double(20, 2) NULL COMMENT '成本价' AFTER `volume`,
ADD COLUMN `wholesale` double(20, 0) NULL COMMENT '批发价' AFTER `price`,
ADD COLUMN `time_length` int(10) NULL COMMENT '服务时长' AFTER `wholesale`,
ADD COLUMN `proReward` double(20, 0) NULL COMMENT '服务提成' AFTER `time_length`;


ALTER TABLE `shopping_goods_assemble`
ADD COLUMN `assemble_good_id` bigint(0) NULL COMMENT '组合产品ID' AFTER `assembleGoodId`;


ALTER TABLE `shopping_goods`
    ADD COLUMN `use_shop`  varchar(1000) NULL COMMENT '品种可用门店' AFTER `proReward`;


ALTER TABLE `shopping_goods`
    ADD COLUMN `headquarters`  int(2) NULL COMMENT '是否为总部产品，1是2不是' AFTER `use_shop`;

ALTER TABLE `sys_shop_info`
    ADD COLUMN `shop_type`  int(2) NULL COMMENT '门店类型1.总部，2.门店，3.加盟店' AFTER `shop_short_name`;





-- 数据迁移
update shopping_goods set headquarters=2
where ISNULL(headquarters);


update sys_data_dictionary set type='入库类型' where type='产品用途';


ALTER TABLE `money_card_use`
ADD COLUMN `card_name` varchar(255) NULL COMMENT '充值卡名称' AFTER `remark`;
/**
充值卡改造后需要为已经导入的用户生成一个默认的储值卡
 */

/**
  供应商菜单管理，改为往来单位管理

 */


ALTER TABLE `sys_proj_use`
ADD COLUMN `proj_name` varchar(500) NULL COMMENT '项目名称' AFTER `remark`,
ADD COLUMN `deductionNum` int(255) NULL COMMENT '单次扣减次数' AFTER `proj_name`;
ALTER TABLE sys_proj_use
ADD COLUMN `tcName` varchar(255) NULL COMMENT '套餐名称' AFTER `deductionNum`;

ALTER TABLE `sys_proj_use`
ADD COLUMN `is_course` varchar(2) NULL COMMENT '套餐类型 N=固定套餐，Y=任选套餐' AFTER `tcName`;




















