/*!40101 SET NAMES utf8mb4 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`mall4cloud_group` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci */ /*!80016 DEFAULT ENCRYPTION='N' */;

USE `mall4cloud_group`;

/*Table structure for table `group_activity` */

DROP TABLE IF EXISTS `group_activity`;

CREATE TABLE `group_activity` (
  `group_activity_id` bigint NOT NULL AUTO_INCREMENT COMMENT '拼团活动id',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `shop_id` bigint DEFAULT NULL COMMENT '店铺id',
  `activity_name` varchar(30) DEFAULT NULL COMMENT '活动名称',
  `start_time` datetime DEFAULT NULL COMMENT '活动开始时间（活动状态：未开始、经行中、已结束）',
  `end_time` datetime DEFAULT NULL COMMENT '活动结束时间（活动状态：未开始、经行中、已结束）',
  `group_valid_time` int DEFAULT NULL COMMENT '成团有效期时间',
  `group_number` int DEFAULT NULL COMMENT '成团人数',
  `has_max_num` tinyint(1) DEFAULT NULL COMMENT '商品是否限购（1:限购、0:不限购）',
  `max_num` int DEFAULT NULL COMMENT '限购数量',
  `has_robot` tinyint(1) DEFAULT NULL COMMENT '是否模拟成团（1:模拟参团、0:不模拟）',
  `is_preheat` int DEFAULT NULL COMMENT '活动是否预热',
  `has_group_tip` tinyint DEFAULT NULL COMMENT '是否开启凑团模式（1:凑团、0:不凑团）',
  `spu_id` bigint NOT NULL COMMENT '商品id',
  `price` bigint NOT NULL COMMENT '商品价格（sku最低价）',
  `group_order_count` bigint NOT NULL DEFAULT '0' COMMENT '已成团订单数（统计）',
  `group_number_count` bigint NOT NULL DEFAULT '0' COMMENT '已成团人数（统计）',
  `status` tinyint(1) DEFAULT NULL COMMENT '拼团状态(-1:删除、0:未启用、1:启用、2:违规下架、3:等待审核 4:已失效)',
  PRIMARY KEY (`group_activity_id`),
  KEY `shop_id` (`shop_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='拼团活动表';

/*Data for the table `group_activity` */


/*Table structure for table `group_sku` */

DROP TABLE IF EXISTS `group_sku`;

CREATE TABLE `group_sku` (
  `group_sku_id` bigint NOT NULL AUTO_INCREMENT COMMENT '拼团活动商品规格id',
  `group_activity_id` bigint DEFAULT NULL COMMENT '拼团活动id',
  `sku_id` bigint DEFAULT NULL COMMENT '商品规格id',
  `act_price` bigint DEFAULT NULL COMMENT '活动价格',
  `sell_num` bigint NOT NULL DEFAULT '0' COMMENT '已售数量',
  PRIMARY KEY (`group_sku_id`),
  KEY `sku_id` (`sku_id`),
  KEY `group_activity_id` (`group_activity_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='拼团活动商品规格';

/*Data for the table `group_sku` */

/*Table structure for table `leaf_alloc` */

CREATE TABLE IF NOT EXISTS `leaf_alloc` (
  `biz_tag` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '区分业务',
  `max_id` bigint unsigned NOT NULL DEFAULT '1' COMMENT '该biz_tag目前所被分配的ID号段的最大值',
  `step` int NOT NULL COMMENT '每次分配的号段长度',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `description` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '描述',
PRIMARY KEY (`biz_tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

/*Data for the table `leaf_alloc` */


/*Table structure for table `undo_log` */

DROP TABLE IF EXISTS `undo_log`;

CREATE TABLE `undo_log` (
  `id` bigint NOT NULL AUTO_INCREMENT,
  `branch_id` bigint NOT NULL,
  `xid` varchar(100) NOT NULL,
  `context` varchar(128) NOT NULL,
  `rollback_info` longblob NOT NULL,
  `log_status` int NOT NULL,
  `log_created` datetime NOT NULL,
  `log_modified` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

/*Data for the table `undo_log` */

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
