-- AR_SHOP_GOODS表结构修改
ALTER TABLE `AR_SHOP_GOODS` ADD `IS_DEL` TINYINT(2) UNSIGNED NOT NULL DEFAULT '0' COMMENT '是否删除';
ALTER TABLE `AR_SHOP_GOODS` ADD `DELETED_AT` INT(10) NOT NULL DEFAULT '0' COMMENT '删除时间';
ALTER TABLE `AR_SHOP_GOODS` ADD `POINT` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '兑换点数';
ALTER TABLE `AR_SHOP_GOODS` ADD `SELL_TYPE` VARCHAR(32) NOT NULL DEFAULT '1,2' COMMENT '出售方式';

-- AR_ORDER_GOODS表结构修改
ALTER TABLE `AR_ORDER_GOODS` ADD `POINT` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' COMMENT '兑换点数';

-- AR_ORDER表结构修改
ALTER TABLE `AR_ORDER` ADD `PAY_TYPE` VARCHAR(32) NOT NULL DEFAULT 'cash' COMMENT '支付方式';

-- 03-15更新表结构
ALTER TABLE `AR_FLOW_WALLET`
ADD COLUMN `TRANSFER_SN` varchar(32) DEFAULT NULL AFTER `SORT`;

ALTER TABLE `AR_DECLARATION_PACKAGE`
ADD COLUMN `PACKAGE_NO` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT 'PG546763' AFTER `PACKAGE_NAME`;

ALTER TABLE `AR_ORDER`
ADD COLUMN `WAREHOUSE` varchar(16) COLLATE utf8mb4_bin NOT NULL DEFAULT '01' AFTER `PAY_TYPE`;

UPDATE AR_CONFIG SET VALUE='[{"out":"bonus","in":"cash","outMin":"100","outMax":"0","fee":"3","feeMin":"0","feeMax":"0","weekMax":"0","monthMax":"0","isSystem":true,"isBind":true,"isOpen":true},{"out":"bonus","in":"bonus","outMin":"100","outMax":"0","fee":"0","feeMin":"0","feeMax":"0","weekMax":"0","monthMax":"0","isSystem":true,"isBind":true,"isOpen":true},{"out":"cash","in":"cash","outMin":"100","outMax":"0","fee":"0","feeMin":"0","feeMax":"0","weekMax":"0","monthMax":"0","isSystem":true,"isBind":true,"isOpen":true}]' WHERE CONFIG_NAME='allowWallet';

-- ALTER TABLE `AR_USER_WALLET`
-- MODIFY COLUMN `CASH` decimal(16, 2) UNSIGNED NOT NULL DEFAULT 0.00 AFTER `USER_ID`;
-- ALTER TABLE `AR_USER_BONUS`
-- MODIFY COLUMN `BONUS` decimal(16, 2) UNSIGNED NOT NULL DEFAULT 0.00 AFTER `USER_ID`;


DROP TABLE IF EXISTS `AR_TMP_OLD_NETWORK`;
CREATE TABLE `AR_TMP_OLD_NETWORK` (
  `ID` varchar(32) NOT NULL,
  `USER_NAME` varchar(16) NOT NULL,
  `REAL_NAME` varchar(128) NOT NULL,
  `PARENT_USER_NAME` varchar(16) NOT NULL,
  `PARENT_REAL_NAME` varchar(128) NOT NULL,
  `NET_USER_NAME` varchar(16) NOT NULL,
  `NET_REAL_NAME` varchar(128) NOT NULL,
  `SORT` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `NET_DEEP` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `REC_DEEP` int(10) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  KEY `USER_NAME` (`USER_NAME`) USING BTREE,
  KEY `PARENT_USER_NAME` (`PARENT_USER_NAME`) USING BTREE,
  KEY `NET_USER_NAME` (`NET_USER_NAME`) USING BTREE,
  KEY `SORT` (`SORT`) USING BTREE,
  KEY `NET_DEEP` (`NET_DEEP`) USING BTREE,
  KEY `REC_DEEP` (`REC_DEEP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='excel新增会员关系临时表';


CREATE TABLE `AR_TMP_OLD_NETWORK_ALL` (
  `ID` varchar(32) NOT NULL,
  `USER_NAME` varchar(16) NOT NULL,
  `REAL_NAME` varchar(128) NOT NULL,
  `PARENT_USER_NAME` varchar(16) NOT NULL,
  `PARENT_REAL_NAME` varchar(128) NOT NULL,
  `NET_USER_NAME` varchar(16) NOT NULL,
  `NET_REAL_NAME` varchar(128) NOT NULL,
  `REC_DEEP` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `NET_DEEP` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `SORT` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `NET_SAME` tinyint(2) NOT NULL DEFAULT '0' COMMENT '相同0 不同1',
  `REC_SAME` tinyint(2) NOT NULL DEFAULT '0',
  `OLD_IS_EXSIT` tinyint(2) NOT NULL DEFAULT '0' COMMENT '0 不存在 1 存在',
  PRIMARY KEY (`ID`),
  KEY `USER_NAME` (`USER_NAME`) USING BTREE,
  KEY `PARENT_USER_NAME` (`PARENT_USER_NAME`) USING BTREE,
  KEY `NET_USER_NAME` (`NET_USER_NAME`) USING BTREE,
  KEY `SORT` (`SORT`) USING BTREE,
  KEY `NET_DEEP` (`NET_DEEP`) USING BTREE,
  KEY `REC_DEEP` (`REC_DEEP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='老系统总会员关系临时表';



CREATE TABLE `AR_TMP_DELETE_USER` (
  `ID` varchar(32) NOT NULL,
  `USER_NAME` varchar(16) NOT NULL,
  `REAL_NAME` varchar(128) NOT NULL,
  `USER_ID` varchar(32) NOT NULL COMMENT '用户ID',
  PRIMARY KEY (`ID`),
  KEY `USER_ID` (`USER_ID`) USING BTREE,
  KEY `USER_NAME` (`USER_NAME`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='线上会员多于34w的会员';



CREATE TABLE `AR_TMP_OLD_NETWORK_ERROR` (
  `ID` varchar(32) NOT NULL,
  `USER_NAME` varchar(16) NOT NULL,
  `REAL_NAME` varchar(128) NOT NULL,
  `PARENT_USER_NAME` varchar(16) NOT NULL,
  `PARENT_REAL_NAME` varchar(128) NOT NULL,
  `NET_USER_NAME` varchar(16) NOT NULL,
  `NET_REAL_NAME` varchar(128) NOT NULL,
  `REC_DEEP` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `NET_DEEP` int(10) UNSIGNED NOT NULL DEFAULT '0',
  `SORT` int(10) UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`ID`),
  KEY `USER_NAME` (`USER_NAME`) USING BTREE,
  KEY `PARENT_USER_NAME` (`PARENT_USER_NAME`) USING BTREE,
  KEY `NET_USER_NAME` (`NET_USER_NAME`) USING BTREE,
  KEY `SORT` (`SORT`) USING BTREE,
  KEY `NET_DEEP` (`NET_DEEP`) USING BTREE,
  KEY `REC_DEEP` (`REC_DEEP`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='改错表';



CREATE TABLE `AR_USER_REG` (
  `ID` varchar(32) NOT NULL,
  `USER_NAME` varchar(16) NOT NULL,
  `REAL_NAME` varchar(128) NOT NULL,
  `CON_UID` varchar(32) NOT NULL,
  `REC_UID` varchar(32) NOT NULL,
  `PARENT_USER_NAME` varchar(16) NOT NULL,
  `PARENT_REAL_NAME` varchar(128) NOT NULL,
  `NET_USER_NAME` varchar(16) NOT NULL,
  `NET_REAL_NAME` varchar(128) NOT NULL,
  PRIMARY KEY (`ID`),
  KEY `USER_NAME` (`USER_NAME`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='正式站报单用户44';

