ALTER TABLE `mt_give_item`
  CHANGE `UPDATE_TIEM` `UPDATE_TIME` DATETIME NOT NULL COMMENT '更新时间';

ALTER TABLE `mt_balance`
  ADD COLUMN `STORE_ID` INT DEFAULT 0 NULL COMMENT '所属店铺ID' AFTER `ID`;

ALTER TABLE `mt_point`
  ADD COLUMN `STORE_ID` INT DEFAULT 0 NULL COMMENT '所属店铺ID' AFTER `ID`;

ALTER TABLE `mt_store`
  CHANGE `ALIPAY_PRIVATE_KEY` `ALIPAY_PRIVATE_KEY` VARCHAR (5000) CHARSET utf8 COLLATE utf8_general_ci DEFAULT '' NULL COMMENT '支付宝应用私钥',
  CHANGE `ALIPAY_PUBLIC_KEY` `ALIPAY_PUBLIC_KEY` VARCHAR (5000) CHARSET utf8 COLLATE utf8_general_ci DEFAULT '' NULL COMMENT '支付宝应用公钥';

DROP TABLE IF EXISTS `mt_stock`;
CREATE TABLE `mt_stock` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '自增ID',
  `STORE_ID` int NOT NULL DEFAULT '0' COMMENT '店铺ID',
  `TYPE` varchar(20) NOT NULL DEFAULT 'increase' COMMENT '类型，increase:入库，reduce:出库',
  `DESCRIPTION` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '备注说明',
  `CREATE_TIME` datetime DEFAULT NULL COMMENT '创建时间',
  `UPDATE_TIME` datetime DEFAULT NULL COMMENT '更新时间',
  `OPERATOR` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '最后操作人',
  `STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A' COMMENT '状态',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='库存管理记录表';

DROP TABLE IF EXISTS `mt_stock_item`;
CREATE TABLE `mt_stock_item` (
  `ID` int NOT NULL AUTO_INCREMENT COMMENT '自增ID',
  `STOCK_ID` int NOT NULL DEFAULT '0' COMMENT '库存管理ID',
  `GOODS_ID` int NOT NULL DEFAULT '0' COMMENT '商品ID',
  `SKU_ID` int NOT NULL DEFAULT '0' COMMENT 'SKUID',
  `NUM` int NOT NULL DEFAULT '0' COMMENT '数量',
  `DESCRIPTION` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT '' COMMENT '说明备注',
  `CREATE_TIME` datetime NOT NULL COMMENT '创建时间',
  `UPDATE_TIME` datetime NOT NULL COMMENT '更新时间',
  `OPERATOR` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '最后操作人',
  `STATUS` char(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A' COMMENT '订单状态',
  PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='库存管理明细表';