ALTER TABLE `mt_merchant` ADD COLUMN `TYPE` VARCHAR (30) DEFAULT '' NULL COMMENT '类型,restaurant:餐饮;retail:零售;service:服务;other:其他' AFTER `ID`; ALTER TABLE `mt_coupon` ADD COLUMN `EXPIRE_TYPE` VARCHAR (30) DEFAULT '' NULL COMMENT '过期类型' AFTER `USE_FOR`, ADD COLUMN `EXPIRE_TIME` INT (10) DEFAULT 0 NULL COMMENT '有效期,单位:天' AFTER `EXPIRE_TYPE`; ALTER TABLE `mt_merchant` ADD COLUMN `WX_APP_ID` VARCHAR (50) DEFAULT '' NULL COMMENT '微信小程序appId' AFTER `ADDRESS`, ADD COLUMN `WX_APP_SECRET` VARCHAR (50) DEFAULT '' NULL COMMENT '微信小程序秘钥' AFTER `WX_APP_ID`, ADD COLUMN `WX_OFFICIAL_APP_ID` VARCHAR (50) DEFAULT '' NULL COMMENT '微信公众号appId' AFTER `WX_APP_SECRET`, ADD COLUMN `WX_OFFICIAL_APP_SECRET` VARCHAR (50) DEFAULT '' NULL COMMENT '微信公众号秘钥' AFTER `WX_OFFICIAL_APP_ID`; ALTER TABLE `mt_message` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`; ALTER TABLE `mt_article` CHANGE `STORE_ID` `STORE_ID` INT DEFAULT 0 NOT NULL COMMENT '目录ID' AFTER `ID`, ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `STORE_ID`; ALTER TABLE `mt_balance` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `ID`; ALTER TABLE `mt_banner` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `TITLE`; ALTER TABLE `mt_book` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `ID`, CHANGE `STORE_ID` `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID', CHANGE `GOODS_ID` `GOODS_ID` INT DEFAULT 0 NULL COMMENT '预约服务ID'; ALTER TABLE `mt_book_item` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `ID`, CHANGE `STORE_ID` `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID', CHANGE `GOODS_ID` `GOODS_ID` INT DEFAULT 0 NULL COMMENT '预约服务ID'; ALTER TABLE `mt_cart` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `USER_ID`; ALTER TABLE `mt_coupon` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`, ADD COLUMN `STORE_ID` INT DEFAULT 0 COMMENT '店铺ID' AFTER `MERCHANT_ID`; ALTER TABLE `mt_coupon_group` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`, ADD COLUMN `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID' AFTER `MERCHANT_ID`; ALTER TABLE `mt_freight` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`, ADD COLUMN `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID' AFTER `MERCHANT_ID`; ALTER TABLE `mt_give` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `USER_ID`; ALTER TABLE `mt_goods` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `TYPE`; ALTER TABLE `mt_goods_cate` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户' AFTER `ID`; ALTER TABLE `mt_open_gift` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`; ALTER TABLE `mt_order` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `COUPON_ID`; ALTER TABLE `mt_point` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `ID`, CHANGE `STORE_ID` `STORE_ID` INT DEFAULT 0 NULL COMMENT '所属店铺ID'; ALTER TABLE `mt_refund` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `ORDER_ID`; ALTER TABLE `mt_send_log` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`, ADD COLUMN `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID' AFTER `MERCHANT_ID`; ALTER TABLE `mt_setting` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`, ADD COLUMN `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID' AFTER `MERCHANT_ID`; ALTER TABLE `mt_sms_sended_log` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `LOG_ID`, ADD COLUMN `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID' AFTER `MERCHANT_ID`; ALTER TABLE `mt_sms_template` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`, ADD COLUMN `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID' AFTER `MERCHANT_ID`; ALTER TABLE `mt_staff` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`, CHANGE `STORE_ID` `STORE_ID` INT DEFAULT 0 NULL COMMENT '店铺ID'; ALTER TABLE `mt_user` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '所属商户ID' AFTER `ADDRESS`, CHANGE `STORE_ID` `STORE_ID` INT DEFAULT 0 NULL COMMENT '所属店铺ID'; ALTER TABLE `mt_user_action` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `USER_ID`; ALTER TABLE `mt_user_coupon` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `USER_ID`, CHANGE `STORE_ID` `STORE_ID` INT DEFAULT 0 NULL COMMENT '使用店铺ID'; ALTER TABLE `mt_user_grade` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`; ALTER TABLE `mt_confirm_log` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `OPERATOR_USER_ID`; ALTER TABLE `mt_stock` ADD COLUMN `MERCHANT_ID` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `ID`; ALTER TABLE `t_duty` ADD COLUMN `merchant_id` INT DEFAULT 0 NULL COMMENT '商户ID' FIRST; ALTER TABLE `t_source` ADD COLUMN `merchant_id` INT DEFAULT 0 NULL COMMENT '商户ID' FIRST; ALTER TABLE `t_action_log` ADD COLUMN `merchant_id` INT DEFAULT 0 NULL COMMENT '商户ID' AFTER `id`, ADD COLUMN `store_id` INT DEFAULT 0 NULL COMMENT '店铺ID' AFTER `merchant_id`; UPDATE `mt_coupon` SET MERCHANT_ID = '1', STORE_ID = '1'; UPDATE `mt_coupon_group` SET MERCHANT_ID = '1', STORE_ID = '1'; UPDATE `mt_give` SET MERCHANT_ID = '1', STORE_ID = '1'; UPDATE `mt_goods` SET MERCHANT_ID = '1'; UPDATE `mt_goods_cate` SET MERCHANT_ID = '1'; UPDATE `mt_open_gift` SET MERCHANT_ID = '1'; UPDATE `mt_order` SET MERCHANT_ID = '1'; UPDATE `mt_refund` SET MERCHANT_ID = '1'; UPDATE `mt_setting` SET MERCHANT_ID = '1'; UPDATE `mt_sms_template` SET MERCHANT_ID = '1'; UPDATE `mt_staff` SET MERCHANT_ID = '1'; UPDATE `mt_user` SET MERCHANT_ID = '1'; UPDATE `mt_user_action` SET MERCHANT_ID = '1'; UPDATE `mt_user_coupon` SET MERCHANT_ID = '1'; UPDATE `mt_user_grade` SET MERCHANT_ID = '1'; UPDATE `t_duty` SET merchant_id = '1'; UPDATE `t_source` SET merchant_id = '1';