DROP TABLE IF EXISTS `tyg_shop_withdrawal_record`;
CREATE TABLE `tyg_shop_withdrawal_record` (
`record_id` bigint(18) NOT NULL AUTO_INCREMENT COMMENT '分销店提现记录表',
`shop_id` bigint(18) DEFAULT NULL COMMENT '店铺id',
`shop_type` tinyint(2) DEFAULT NULL COMMENT '店铺类型:1',
`user_bank_id` bigint(18) DEFAULT NULL COMMENT '提现银行卡编号',
`money` decimal(18,2) DEFAULT NULL COMMENT '提现金额',
`poundage` decimal(18,2) DEFAULT NULL COMMENT '手续费',
`state` tinyint(4) DEFAULT NULL COMMENT '提现状态:0审核中,1提现成功,-1审核失败',
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
`create_time` bigint(13) DEFAULT NULL COMMENT '创建时间',
`update_time` bigint(13) DEFAULT NULL COMMENT '更新、审核时间',
PRIMARY KEY (`record_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC ;
注意:PRIMARY KEY (record_id) USING BTREE
中的using btree
h2不知道为什么有这个就报错,删除就好了;好像是不需要主键设置索引
DROP TABLE IF EXISTS `tyg_logistics`;
CREATE TABLE `tyg_logistics` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`ref_id` bigint(20) NOT NULL COMMENT '关联ID',
`ref_type` int(2) NOT NULL COMMENT '关联类型(1:订单,2:发票)',
`waybill_number` varchar(30) NOT NULL COMMENT '运单编号',
`logistics_company` varchar(10) NOT NULL COMMENT '运单公司',
`version` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '乐观锁,同时记录修改次数',
`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
`gmt_modify` bigint(20) NOT NULL COMMENT '修改时间',
PRIMARY KEY (`id`) ,
UNIQUE KEY `uniq_ref_id_ref_type` (`ref_id`,`ref_type`) USING BTREE COMMENT '关联ID类型唯一索引'
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
注意:UNIQUE KEY uniq_ref_id_ref_type (ref_id,ref_type) USING BTREE COMMENT 关联ID类型唯一索引
h2好像不支持外键,删除就好了
注意删除之后不要多个逗号
DROP TABLE IF EXISTS `tyg_order`;
CREATE TABLE `tyg_order` (
`order_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单Id',
`send_commodity_time` bigint(13) unsigned zerofill DEFAULT NULL COMMENT '发货时间',
`strike_bargain_time` bigint(13) DEFAULT NULL COMMENT '成交时间-买家确认订单时间',
PRIMARY KEY (`order_id`),
KEY `FK_Reference_60` (`shop_id`),
KEY `FK_Reference_62` (`member_sponsor_id`),
KEY `FK_Reference_66` (`red_package_id`),
KEY `FK_Reference_70` (`selected_adress_id`)
) ENGINE=InnoDB AUTO_INCREMENT=258834 DEFAULT CHARSET=utf8 ;
注意unsigned zerofill
h2肯定不支持mysql函数,删除就好了
DROP TABLE IF EXISTS `tyg_user_withdrawals`;
CREATE TABLE `tyg_user_withdrawals` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
`trade_no` varchar(30) NOT NULL COMMENT '提现交易流水号',
`state` tinyint(2) DEFAULT NULL COMMENT '提现进度:1-处理中,2-已到账,3-佣金提现失败',
`bank_card_id` varchar(30) NOT NULL COMMENT '银行卡ID',
`withdrawal_fee` double(10,2) DEFAULT NULL COMMENT '提现手续费',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
注意:double(10,2)
h2肯定不支持double类型,改成decimal就好了
注意:本文归作者所有,未经作者允许,不得转载