From 4a73ea84391c5c22cd146d4550b24105c33de059 Mon Sep 17 00:00:00 2001 From: xiaoxiamo <82970607@qq.com> Date: Sun, 14 Jul 2024 21:17:32 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E8=A7=84=E8=8C=83=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=EF=BC=88=E4=B8=80=EF=BC=89=EF=BC=9A=E6=95=B4=E7=90=86?= =?UTF-8?q?SQL=E8=84=9A=E6=9C=AC=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/sql/austin.sql | 126 ++++++++--------- doc/sql/nacos.sql | 322 +++++++++++++++++++++++--------------------- doc/sql/xxl-job.sql | 246 +++++++++++++++++---------------- 3 files changed, 355 insertions(+), 339 deletions(-) diff --git a/doc/sql/austin.sql b/doc/sql/austin.sql index 10f96be..15d0fe7 100644 --- a/doc/sql/austin.sql +++ b/doc/sql/austin.sql @@ -1,84 +1,70 @@ -drop database if exists austin; +DROP DATABASE IF EXISTS `austin`; -create database austin; +CREATE DATABASE `austin`; -use austin; +USE `austin`; -drop table IF EXISTS message_template; - -CREATE TABLE `message_template` +CREATE TABLE IF NOT EXISTS `message_template` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '标题', - `audit_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '当前消息审核状态: 10.待审核 20.审核成功 30.被拒绝', - `flow_id` varchar(50) COLLATE utf8mb4_unicode_ci COMMENT '工单ID', - `msg_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '当前消息状态:10.新建 20.停用 30.启用 40.等待发送 50.发送中 60.发送成功 70.发送失败', - `cron_task_id` bigint(20) COMMENT '定时任务Id (xxl-job-admin返回)', - `cron_crowd_path` varchar(500) COMMENT '定时发送人群的文件路径', - `expect_push_time` varchar(100) COLLATE utf8mb4_unicode_ci COMMENT '期望发送时间:0:立即发送 定时任务以及周期任务:cron表达式', - `id_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '消息的发送ID类型:10. userId 20.did 30.手机号 40.openId 50.email 60.企业微信userId', - `send_channel` int(10) NOT NULL DEFAULT '0' COMMENT '消息发送渠道:10.IM 20.Push 30.短信 40.Email 50.公众号 60.小程序 70.企业微信 80.钉钉机器人 90.钉钉工作通知 100.企业微信机器人 110.飞书机器人 110. 飞书应用消息 ', - `template_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '10.运营类 20.技术类接口调用', - `msg_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '10.通知类消息 20.营销类消息 30.验证码类消息', - `shield_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '10.夜间不屏蔽 20.夜间屏蔽 30.夜间屏蔽(次日早上9点发送)', - `msg_content` varchar(4096) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '消息内容 占位符用{$var}表示', - `send_account` int(10) NOT NULL DEFAULT '0' COMMENT '发送账号 一个渠道下可存在多个账号', - `creator` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '创建者', - `updator` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '更新者', - `auditor` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '审核人', - `team` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '业务方团队', - `proposer` varchar(45) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '业务方', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除:0.不删除 1.删除', - `created` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `updated` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '标题', + `audit_status` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '当前消息审核状态: 10.待审核 20.审核成功 30.被拒绝', + `flow_id` VARCHAR(50) COMMENT '工单ID', + `msg_status` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '当前消息状态:10.新建 20.停用 30.启用 40.等待发送 50.发送中 60.发送成功 70.发送失败', + `cron_task_id` BIGINT(20) COMMENT '定时任务Id (xxl-job-admin返回)', + `cron_crowd_path` VARCHAR(500) COMMENT '定时发送人群的文件路径', + `expect_push_time` VARCHAR(100) COMMENT '期望发送时间:0:立即发送 定时任务以及周期任务:cron表达式', + `id_type` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '消息的发送ID类型:10. userId 20.did 30.手机号 40.openId 50.email 60.企业微信userId', + `send_channel` INT(10) NOT NULL DEFAULT '0' COMMENT '消息发送渠道:10.IM 20.Push 30.短信 40.Email 50.公众号 60.小程序 70.企业微信 80.钉钉机器人 90.钉钉工作通知 100.企业微信机器人 110.飞书机器人 110. 飞书应用消息 ', + `template_type` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '10.运营类 20.技术类接口调用', + `msg_type` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '10.通知类消息 20.营销类消息 30.验证码类消息', + `shield_type` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '10.夜间不屏蔽 20.夜间屏蔽 30.夜间屏蔽(次日早上9点发送)', + `msg_content` VARCHAR(4096) NOT NULL DEFAULT '' COMMENT '消息内容 占位符用{$var}表示', + `send_account` INT(10) NOT NULL DEFAULT '0' COMMENT '发送账号 一个渠道下可存在多个账号', + `creator` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '创建者', + `updator` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '更新者', + `auditor` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '审核人', + `team` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '业务方团队', + `proposer` VARCHAR(45) NOT NULL DEFAULT '' COMMENT '业务方', + `is_deleted` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '是否删除:0.不删除 1.删除', + `created` INT(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `updated` INT(11) NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`), - KEY `idx_channel` (`send_channel`) + KEY `idx_channel` (`send_channel`) ) ENGINE = InnoDB - AUTO_INCREMENT = 1 - DEFAULT CHARSET = utf8mb4 - COLLATE = utf8mb4_unicode_ci COMMENT ='消息模板信息'; - - + DEFAULT CHARSET = utf8mb4 COMMENT ='消息模板信息'; -CREATE TABLE `sms_record` +CREATE TABLE IF NOT EXISTS `sms_record` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `message_template_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '消息模板ID', - `phone` bigint(20) NOT NULL DEFAULT '0' COMMENT '手机号', - `supplier_id` tinyint(4) NOT NULL DEFAULT '0' COMMENT '发送短信渠道商的ID', - `supplier_name` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '发送短信渠道商的名称', - `msg_content` varchar(600) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '短信发送的内容', - `series_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '下发批次的ID', - `charging_num` tinyint(4) NOT NULL DEFAULT '0' COMMENT '计费条数', - `report_content` varchar(50) NOT NULL DEFAULT '' COMMENT '回执内容', - `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '短信状态: 10.发送 20.成功 30.失败', - `send_date` int(11) NOT NULL DEFAULT '0' COMMENT '发送日期:20211112', - `created` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `updated` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `message_template_id` BIGINT(20) NOT NULL DEFAULT '0' COMMENT '消息模板ID', + `phone` BIGINT(20) NOT NULL DEFAULT '0' COMMENT '手机号', + `supplier_id` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '发送短信渠道商的ID', + `supplier_name` VARCHAR(40) NOT NULL DEFAULT '' COMMENT '发送短信渠道商的名称', + `msg_content` VARCHAR(600) NOT NULL DEFAULT '' COMMENT '短信发送的内容', + `series_id` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '下发批次的ID', + `charging_num` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '计费条数', + `report_content` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '回执内容', + `status` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '短信状态: 10.发送 20.成功 30.失败', + `send_date` INT(11) NOT NULL DEFAULT '0' COMMENT '发送日期:20211112', + `created` INT(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `updated` INT(11) NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`), - KEY `idx_send_date` (`send_date`) + KEY `idx_send_date` (`send_date`) ) ENGINE = InnoDB - AUTO_INCREMENT = 1 - DEFAULT CHARSET = utf8mb4 - COLLATE = utf8mb4_unicode_ci COMMENT ='短信记录信息'; + DEFAULT CHARSET = utf8mb4 COMMENT ='短信记录信息'; -drop table IF EXISTS channel_account; - - -CREATE TABLE `channel_account` +CREATE TABLE IF NOT EXISTS `channel_account` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '账号名称', - `send_channel` tinyint(4) NOT NULL DEFAULT '0' COMMENT '消息发送渠道:10.IM 20.Push 30.短信 40.Email 50.公众号 60.小程序 70.企业微信 80.钉钉机器人 90.钉钉工作通知 100.企业微信机器人 110.飞书机器人 110. 飞书应用消息 ', - `account_config` varchar(1024) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '账号配置', - `creator` varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'Java3y' COMMENT '拥有者', - `created` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', - `updated` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间', - `is_deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否删除:0.不删除 1.删除', + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `name` VARCHAR(100) NOT NULL DEFAULT '' COMMENT '账号名称', + `send_channel` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '消息发送渠道:10.IM 20.Push 30.短信 40.Email 50.公众号 60.小程序 70.企业微信 80.钉钉机器人 90.钉钉工作通知 100.企业微信机器人 110.飞书机器人 110. 飞书应用消息 ', + `account_config` VARCHAR(1024) NOT NULL DEFAULT '' COMMENT '账号配置', + `creator` VARCHAR(128) NOT NULL DEFAULT 'Java3y' COMMENT '拥有者', + `created` INT(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `updated` INT(11) NOT NULL DEFAULT '0' COMMENT '更新时间', + `is_deleted` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '是否删除:0.不删除 1.删除', PRIMARY KEY (`id`), - KEY `idx_send_channel` (`send_channel`) + KEY `idx_send_channel` (`send_channel`) ) ENGINE = InnoDB - AUTO_INCREMENT = 1 - DEFAULT CHARSET = utf8mb4 - COLLATE = utf8mb4_unicode_ci COMMENT ='渠道账号信息'; - + DEFAULT CHARSET = utf8mb4 COMMENT ='渠道账号信息'; \ No newline at end of file diff --git a/doc/sql/nacos.sql b/doc/sql/nacos.sql index 2e68956..5343b95 100644 --- a/doc/sql/nacos.sql +++ b/doc/sql/nacos.sql @@ -1,192 +1,202 @@ -drop database if exists nacos_config; -create database nacos_config; -use nacos_config; +DROP DATABASE IF EXISTS `nacos_config`; -CREATE TABLE `config_info` +CREATE DATABASE `nacos_config`; + +USE `nacos_config`; + +CREATE TABLE IF NOT EXISTS `config_info` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `data_id` varchar(255) NOT NULL COMMENT 'data_id', - `group_id` varchar(255) DEFAULT NULL, - `content` longtext NOT NULL COMMENT 'content', - `md5` varchar(32) DEFAULT NULL COMMENT 'md5', - `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', - `src_user` text COMMENT 'source user', - `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip', - `app_name` varchar(128) DEFAULT NULL, - `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段', - `c_desc` varchar(256) DEFAULT NULL, - `c_use` varchar(64) DEFAULT NULL, - `effect` varchar(64) DEFAULT NULL, - `type` varchar(64) DEFAULT NULL, - `encrypted_data_key` varchar(255) DEFAULT NULL, - `c_schema` text, + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `data_id` VARCHAR(255) NOT NULL COMMENT 'data_id', + `group_id` VARCHAR(255) DEFAULT NULL COMMENT 'group_id', + `content` LONGTEXT NOT NULL COMMENT 'content', + `md5` VARCHAR(32) DEFAULT NULL COMMENT 'md5', + `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', + `src_user` TEXT COMMENT 'source user', + `src_ip` VARCHAR(50) DEFAULT NULL COMMENT 'source ip', + `app_name` VARCHAR(128) DEFAULT NULL, + `tenant_id` VARCHAR(128) DEFAULT '' COMMENT '租户字段', + `c_desc` VARCHAR(256) DEFAULT NULL, + `c_use` VARCHAR(64) DEFAULT NULL, + `effect` VARCHAR(64) DEFAULT NULL, + `type` VARCHAR(64) DEFAULT NULL, + `encrypted_data_key` VARCHAR(255) DEFAULT NULL, + `c_schema` TEXT, PRIMARY KEY (`id`), - UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`,`group_id`,`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info'; + UNIQUE KEY `uk_configinfo_datagrouptenant` (`data_id`, `group_id`, `tenant_id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='config_info'; -CREATE TABLE `config_info_aggr` +CREATE TABLE IF NOT EXISTS `config_info_aggr` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `data_id` varchar(255) NOT NULL COMMENT 'data_id', - `group_id` varchar(255) NOT NULL COMMENT 'group_id', - `datum_id` varchar(255) NOT NULL COMMENT 'datum_id', - `content` longtext NOT NULL COMMENT '内容', - `gmt_modified` datetime NOT NULL COMMENT '修改时间', - `app_name` varchar(128) DEFAULT NULL, - `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段', + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `data_id` VARCHAR(255) NOT NULL COMMENT 'data_id', + `group_id` VARCHAR(255) NOT NULL COMMENT 'group_id', + `datum_id` VARCHAR(255) NOT NULL COMMENT 'datum_id', + `content` LONGTEXT NOT NULL COMMENT '内容', + `gmt_modified` DATETIME NOT NULL COMMENT '修改时间', + `app_name` VARCHAR(128) DEFAULT NULL, + `tenant_id` VARCHAR(128) DEFAULT '' COMMENT '租户字段', PRIMARY KEY (`id`), - UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`,`group_id`,`tenant_id`,`datum_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='增加租户字段'; - + UNIQUE KEY `uk_configinfoaggr_datagrouptenantdatum` (`data_id`, `group_id`, `tenant_id`, `datum_id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='增加租户字段'; - -CREATE TABLE `config_info_beta` +CREATE TABLE IF NOT EXISTS `config_info_beta` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `data_id` varchar(255) NOT NULL COMMENT 'data_id', - `group_id` varchar(128) NOT NULL COMMENT 'group_id', - `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name', - `content` longtext NOT NULL COMMENT 'content', - `beta_ips` varchar(1024) DEFAULT NULL COMMENT 'betaIps', - `md5` varchar(32) DEFAULT NULL COMMENT 'md5', - `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', - `src_user` text COMMENT 'source user', - `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip', - `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段', + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `data_id` VARCHAR(255) NOT NULL COMMENT 'data_id', + `group_id` VARCHAR(128) NOT NULL COMMENT 'group_id', + `app_name` VARCHAR(128) DEFAULT NULL COMMENT 'app_name', + `content` LONGTEXT NOT NULL COMMENT 'content', + `beta_ips` VARCHAR(1024) DEFAULT NULL COMMENT 'betaIps', + `md5` VARCHAR(32) DEFAULT NULL COMMENT 'md5', + `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', + `src_user` TEXT COMMENT 'source user', + `src_ip` VARCHAR(50) DEFAULT NULL COMMENT 'source ip', + `tenant_id` VARCHAR(128) DEFAULT '' COMMENT '租户字段', PRIMARY KEY (`id`), - UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`,`group_id`,`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_beta'; - + UNIQUE KEY `uk_configinfobeta_datagrouptenant` (`data_id`, `group_id`, `tenant_id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='config_info_beta'; -CREATE TABLE `config_info_tag` +CREATE TABLE IF NOT EXISTS `config_info_tag` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `data_id` varchar(255) NOT NULL COMMENT 'data_id', - `group_id` varchar(128) NOT NULL COMMENT 'group_id', - `tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id', - `tag_id` varchar(128) NOT NULL COMMENT 'tag_id', - `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name', - `content` longtext NOT NULL COMMENT 'content', - `md5` varchar(32) DEFAULT NULL COMMENT 'md5', - `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', - `src_user` text COMMENT 'source user', - `src_ip` varchar(50) DEFAULT NULL COMMENT 'source ip', + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `data_id` VARCHAR(255) NOT NULL COMMENT 'data_id', + `group_id` VARCHAR(128) NOT NULL COMMENT 'group_id', + `tenant_id` VARCHAR(128) DEFAULT '' COMMENT 'tenant_id', + `tag_id` VARCHAR(128) NOT NULL COMMENT 'tag_id', + `app_name` VARCHAR(128) DEFAULT NULL COMMENT 'app_name', + `content` LONGTEXT NOT NULL COMMENT 'content', + `md5` VARCHAR(32) DEFAULT NULL COMMENT 'md5', + `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', + `src_user` TEXT COMMENT 'source user', + `src_ip` VARCHAR(50) DEFAULT NULL COMMENT 'source ip', PRIMARY KEY (`id`), - UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`,`group_id`,`tenant_id`,`tag_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info_tag'; + UNIQUE KEY `uk_configinfotag_datagrouptenanttag` (`data_id`, `group_id`, `tenant_id`, `tag_id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='config_info_tag'; - -CREATE TABLE `config_tags_relation` +CREATE TABLE IF NOT EXISTS `config_tags_relation` ( - `id` bigint(20) NOT NULL COMMENT 'id', - `tag_name` varchar(128) NOT NULL COMMENT 'tag_name', - `tag_type` varchar(64) DEFAULT NULL COMMENT 'tag_type', - `data_id` varchar(255) NOT NULL COMMENT 'data_id', - `group_id` varchar(128) NOT NULL COMMENT 'group_id', - `tenant_id` varchar(128) DEFAULT '' COMMENT 'tenant_id', - `nid` bigint(20) NOT NULL AUTO_INCREMENT, + `id` BIGINT(20) NOT NULL COMMENT 'id', + `tag_name` VARCHAR(128) NOT NULL COMMENT 'tag_name', + `tag_type` VARCHAR(64) DEFAULT NULL COMMENT 'tag_type', + `data_id` VARCHAR(255) NOT NULL COMMENT 'data_id', + `group_id` VARCHAR(128) NOT NULL COMMENT 'group_id', + `tenant_id` VARCHAR(128) DEFAULT '' COMMENT 'tenant_id', + `nid` BIGINT(20) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`nid`), - UNIQUE KEY `uk_configtagrelation_configidtag` (`id`,`tag_name`,`tag_type`), - KEY `idx_tenant_id` (`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_tag_relation'; + UNIQUE KEY `uk_configtagrelation_configidtag` (`id`, `tag_name`, `tag_type`), + KEY `idx_tenant_id` (`tenant_id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='config_tag_relation'; -CREATE TABLE `group_capacity` +CREATE TABLE IF NOT EXISTS `group_capacity` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `group_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群', - `quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值', - `usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量', - `max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值', - `max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值', - `max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值', - `max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量', - `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', + `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `group_id` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群', + `quota` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值', + `usage` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '使用量', + `max_size` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值', + `max_aggr_count` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数,,0表示使用默认值', + `max_aggr_size` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值', + `max_history_count` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '最大变更历史数量', + `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', PRIMARY KEY (`id`), UNIQUE KEY `uk_group_id` (`group_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='集群、各Group容量信息表'; - +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='集群、各Group容量信息表'; -CREATE TABLE `his_config_info` +CREATE TABLE IF NOT EXISTS `his_config_info` ( - `id` bigint(64) unsigned NOT NULL, - `nid` bigint(20) unsigned NOT NULL AUTO_INCREMENT, - `data_id` varchar(255) NOT NULL, - `group_id` varchar(128) NOT NULL, - `app_name` varchar(128) DEFAULT NULL COMMENT 'app_name', - `content` longtext NOT NULL, - `md5` varchar(32) DEFAULT NULL, - `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - `src_user` text, - `src_ip` varchar(50) DEFAULT NULL, - `op_type` char(10) DEFAULT NULL, - `tenant_id` varchar(128) DEFAULT '' COMMENT '租户字段', - `encrypted_data_key` varchar(255) DEFAULT NULL, + `id` BIGINT(64) UNSIGNED NOT NULL, + `nid` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, + `data_id` VARCHAR(255) NOT NULL, + `group_id` VARCHAR(128) NOT NULL, + `app_name` VARCHAR(128) DEFAULT NULL COMMENT 'app_name', + `content` LONGTEXT NOT NULL, + `md5` VARCHAR(32) DEFAULT NULL, + `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + `src_user` TEXT, + `src_ip` VARCHAR(50) DEFAULT NULL, + `op_type` CHAR(10) DEFAULT NULL, + `tenant_id` VARCHAR(128) DEFAULT '' COMMENT '租户字段', + `encrypted_data_key` VARCHAR(255) DEFAULT NULL, PRIMARY KEY (`nid`), - KEY `idx_gmt_create` (`gmt_create`), - KEY `idx_gmt_modified` (`gmt_modified`), - KEY `idx_did` (`data_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='多租户改造'; + KEY `idx_gmt_create` (`gmt_create`), + KEY `idx_gmt_modified` (`gmt_modified`), + KEY `idx_did` (`data_id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='多租户改造'; - -CREATE TABLE `tenant_capacity` +CREATE TABLE IF NOT EXISTS `tenant_capacity` ( - `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID', - `tenant_id` varchar(128) NOT NULL DEFAULT '' COMMENT 'Tenant ID', - `quota` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值', - `usage` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用量', - `max_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值', - `max_aggr_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数', - `max_aggr_size` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值', - `max_history_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最大变更历史数量', - `gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', + `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `tenant_id` VARCHAR(128) NOT NULL DEFAULT '' COMMENT 'Tenant ID', + `quota` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '配额,0表示使用默认值', + `usage` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '使用量', + `max_size` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '单个配置大小上限,单位为字节,0表示使用默认值', + `max_aggr_count` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '聚合子配置最大个数', + `max_aggr_size` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值', + `max_history_count` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '最大变更历史数量', + `gmt_create` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `gmt_modified` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间', PRIMARY KEY (`id`), UNIQUE KEY `uk_tenant_id` (`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='租户容量信息表'; - +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='租户容量信息表'; -CREATE TABLE `tenant_info` +CREATE TABLE IF NOT EXISTS `tenant_info` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id', - `kp` varchar(128) NOT NULL COMMENT 'kp', - `tenant_id` varchar(128) default '' COMMENT 'tenant_id', - `tenant_name` varchar(128) default '' COMMENT 'tenant_name', - `tenant_desc` varchar(256) DEFAULT NULL COMMENT 'tenant_desc', - `create_source` varchar(32) DEFAULT NULL COMMENT 'create_source', - `gmt_create` bigint(20) NOT NULL COMMENT '创建时间', - `gmt_modified` bigint(20) NOT NULL COMMENT '修改时间', + `id` BIGINT(20) NOT NULL AUTO_INCREMENT COMMENT 'id', + `kp` VARCHAR(128) NOT NULL COMMENT 'kp', + `tenant_id` VARCHAR(128) DEFAULT '' COMMENT 'tenant_id', + `tenant_name` VARCHAR(128) DEFAULT '' COMMENT 'tenant_name', + `tenant_desc` VARCHAR(256) DEFAULT NULL COMMENT 'tenant_desc', + `create_source` VARCHAR(32) DEFAULT NULL COMMENT 'create_source', + `gmt_create` BIGINT(20) NOT NULL COMMENT '创建时间', + `gmt_modified` BIGINT(20) NOT NULL COMMENT '修改时间', PRIMARY KEY (`id`), - UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`,`tenant_id`), - KEY `idx_tenant_id` (`tenant_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='tenant_info'; + UNIQUE KEY `uk_tenant_info_kptenantid` (`kp`, `tenant_id`), + KEY `idx_tenant_id` (`tenant_id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='tenant_info'; -CREATE TABLE `users` +CREATE TABLE IF NOT EXISTS `users` ( - `username` varchar(50) NOT NULL PRIMARY KEY, - `password` varchar(500) NOT NULL, - `enabled` boolean NOT NULL -); + `username` VARCHAR(50) NOT NULL PRIMARY KEY, + `password` VARCHAR(500) NOT NULL, + `enabled` BOOLEAN NOT NULL +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='users'; -CREATE TABLE `roles` +CREATE TABLE IF NOT EXISTS `roles` ( - `username` varchar(50) NOT NULL, - `role` varchar(50) NOT NULL, - UNIQUE INDEX `idx_user_role` (`username` ASC, `role` ASC) USING BTREE -); + `username` VARCHAR(50) NOT NULL, + `role` VARCHAR(50) NOT NULL, + UNIQUE INDEX `idx_user_role` (`username`, `role`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='roles'; -CREATE TABLE `permissions` +CREATE TABLE IF NOT EXISTS `permissions` ( - `role` varchar(50) NOT NULL, - `resource` varchar(255) NOT NULL, - `action` varchar(8) NOT NULL, - UNIQUE INDEX `uk_role_permission` (`role`,`resource`,`action`) USING BTREE -); - -INSERT INTO users (username, password, enabled) VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE); -INSERT INTO roles (username, role) VALUES ('nacos', 'ROLE_ADMIN'); \ No newline at end of file + `role` VARCHAR(50) NOT NULL, + `resource` VARCHAR(255) NOT NULL, + `action` VARCHAR(8) NOT NULL, + UNIQUE INDEX `uk_role_permission` (`role`, `resource`, `action`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='permissions'; + + +INSERT INTO users (username, password, enabled) +VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', TRUE); +INSERT INTO roles (username, role) +VALUES ('nacos', 'ROLE_ADMIN'); \ No newline at end of file diff --git a/doc/sql/xxl-job.sql b/doc/sql/xxl-job.sql index e0d45b0..6402237 100644 --- a/doc/sql/xxl-job.sql +++ b/doc/sql/xxl-job.sql @@ -1,125 +1,145 @@ -CREATE database if NOT EXISTS `xxl_job` default character set utf8mb4 collate utf8mb4_unicode_ci; -use `xxl_job`; +DROP DATABASE IF EXISTS `xxl_job`; -SET NAMES utf8mb4; +CREATE DATABASE `xxl_job`; -drop table IF EXISTS xxl_job_info; +USE `xxl_job`; -CREATE TABLE `xxl_job_info` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `job_group` int(11) NOT NULL COMMENT '执行器主键ID', - `job_desc` varchar(255) NOT NULL, - `add_time` datetime DEFAULT NULL, - `update_time` datetime DEFAULT NULL, - `author` varchar(64) DEFAULT NULL COMMENT '作者', - `alarm_email` varchar(255) DEFAULT NULL COMMENT '报警邮件', - `schedule_type` varchar(50) NOT NULL DEFAULT 'NONE' COMMENT '调度类型', - `schedule_conf` varchar(128) DEFAULT NULL COMMENT '调度配置,值含义取决于调度类型', - `misfire_strategy` varchar(50) NOT NULL DEFAULT 'DO_NOTHING' COMMENT '调度过期策略', - `executor_route_strategy` varchar(50) DEFAULT NULL COMMENT '执行器路由策略', - `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler', - `executor_param` varchar(512) DEFAULT NULL COMMENT '执行器任务参数', - `executor_block_strategy` varchar(50) DEFAULT NULL COMMENT '阻塞处理策略', - `executor_timeout` int(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒', - `executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '失败重试次数', - `glue_type` varchar(50) NOT NULL COMMENT 'GLUE类型', - `glue_source` mediumtext COMMENT 'GLUE源代码', - `glue_remark` varchar(128) DEFAULT NULL COMMENT 'GLUE备注', - `glue_updatetime` datetime DEFAULT NULL COMMENT 'GLUE更新时间', - `child_jobid` varchar(255) DEFAULT NULL COMMENT '子任务ID,多个逗号分隔', - `trigger_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '调度状态:0-停止,1-运行', - `trigger_last_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '上次调度时间', - `trigger_next_time` bigint(13) NOT NULL DEFAULT '0' COMMENT '下次调度时间', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `xxl_job_info` +( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `job_group` INT(11) NOT NULL COMMENT '执行器主键ID', + `job_desc` VARCHAR(255) NOT NULL, + `add_time` DATETIME DEFAULT NULL, + `update_time` DATETIME DEFAULT NULL, + `author` VARCHAR(64) DEFAULT NULL COMMENT '作者', + `alarm_email` VARCHAR(255) DEFAULT NULL COMMENT '报警邮件', + `schedule_type` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '调度类型', + `schedule_conf` VARCHAR(128) DEFAULT NULL COMMENT '调度配置,值含义取决于调度类型', + `misfire_strategy` VARCHAR(50) NOT NULL DEFAULT 'DO_NOTHING' COMMENT '调度过期策略', + `executor_route_strategy` VARCHAR(50) DEFAULT NULL COMMENT '执行器路由策略', + `executor_handler` VARCHAR(255) DEFAULT NULL COMMENT '执行器任务handler', + `executor_param` VARCHAR(512) DEFAULT NULL COMMENT '执行器任务参数', + `executor_block_strategy` VARCHAR(50) DEFAULT NULL COMMENT '阻塞处理策略', + `executor_timeout` INT(11) NOT NULL DEFAULT '0' COMMENT '任务执行超时时间,单位秒', + `executor_fail_retry_count` INT(11) NOT NULL DEFAULT '0' COMMENT '失败重试次数', + `glue_type` VARCHAR(50) NOT NULL COMMENT 'GLUE类型', + `glue_source` MEDIUMTEXT COMMENT 'GLUE源代码', + `glue_remark` VARCHAR(128) DEFAULT NULL COMMENT 'GLUE备注', + `glue_updatetime` DATETIME DEFAULT NULL COMMENT 'GLUE更新时间', + `child_jobid` VARCHAR(255) DEFAULT NULL COMMENT '子任务ID,多个逗号分隔', + `trigger_status` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '调度状态:0-停止,1-运行', + `trigger_last_time` BIGINT(13) NOT NULL DEFAULT '0' COMMENT '上次调度时间', + `trigger_next_time` BIGINT(13) NOT NULL DEFAULT '0' COMMENT '下次调度时间', + PRIMARY KEY (`id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='xxl_job_info'; -drop table IF EXISTS xxl_job_log; -CREATE TABLE `xxl_job_log` ( - `id` bigint(20) NOT NULL AUTO_INCREMENT, - `job_group` int(11) NOT NULL COMMENT '执行器主键ID', - `job_id` int(11) NOT NULL COMMENT '任务,主键ID', - `executor_address` varchar(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址', - `executor_handler` varchar(255) DEFAULT NULL COMMENT '执行器任务handler', - `executor_param` varchar(512) DEFAULT NULL COMMENT '执行器任务参数', - `executor_sharding_param` varchar(20) DEFAULT NULL COMMENT '执行器任务分片参数,格式如 1/2', - `executor_fail_retry_count` int(11) NOT NULL DEFAULT '0' COMMENT '失败重试次数', - `trigger_time` datetime DEFAULT NULL COMMENT '调度-时间', - `trigger_code` int(11) NOT NULL COMMENT '调度-结果', - `trigger_msg` text COMMENT '调度-日志', - `handle_time` datetime DEFAULT NULL COMMENT '执行-时间', - `handle_code` int(11) NOT NULL COMMENT '执行-状态', - `handle_msg` text COMMENT '执行-日志', - `alarm_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '告警状态:0-默认、1-无需告警、2-告警成功、3-告警失败', - PRIMARY KEY (`id`), - KEY `I_trigger_time` (`trigger_time`), - KEY `I_handle_code` (`handle_code`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `xxl_job_log` +( + `id` BIGINT(20) NOT NULL AUTO_INCREMENT, + `job_group` INT(11) NOT NULL COMMENT '执行器主键ID', + `job_id` INT(11) NOT NULL COMMENT '任务,主键ID', + `executor_address` VARCHAR(255) DEFAULT NULL COMMENT '执行器地址,本次执行的地址', + `executor_handler` VARCHAR(255) DEFAULT NULL COMMENT '执行器任务handler', + `executor_param` VARCHAR(512) DEFAULT NULL COMMENT '执行器任务参数', + `executor_sharding_param` VARCHAR(20) DEFAULT NULL COMMENT '执行器任务分片参数,格式如 1/2', + `executor_fail_retry_count` INT(11) NOT NULL DEFAULT '0' COMMENT '失败重试次数', + `trigger_time` DATETIME DEFAULT NULL COMMENT '调度-时间', + `trigger_code` INT(11) NOT NULL COMMENT '调度-结果', + `trigger_msg` TEXT COMMENT '调度-日志', + `handle_time` DATETIME DEFAULT NULL COMMENT '执行-时间', + `handle_code` INT(11) NOT NULL COMMENT '执行-状态', + `handle_msg` TEXT COMMENT '执行-日志', + `alarm_status` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '告警状态:0-默认、1-无需告警、2-告警成功、3-告警失败', + PRIMARY KEY (`id`), + KEY `I_trigger_time` (`trigger_time`), + KEY `I_handle_code` (`handle_code`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='xxl_job_log'; -drop table IF EXISTS xxl_job_log_report; -CREATE TABLE `xxl_job_log_report` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `trigger_day` datetime DEFAULT NULL COMMENT '调度-时间', - `running_count` int(11) NOT NULL DEFAULT '0' COMMENT '运行中-日志数量', - `suc_count` int(11) NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量', - `fail_count` int(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量', - `update_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `i_trigger_day` (`trigger_day`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `xxl_job_log_report` +( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `trigger_day` DATETIME DEFAULT NULL COMMENT '调度-时间', + `running_count` INT(11) NOT NULL DEFAULT '0' COMMENT '运行中-日志数量', + `suc_count` INT(11) NOT NULL DEFAULT '0' COMMENT '执行成功-日志数量', + `fail_count` INT(11) NOT NULL DEFAULT '0' COMMENT '执行失败-日志数量', + `update_time` DATETIME DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `i_trigger_day` (`trigger_day`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='xxl_job_log_report'; -drop table IF EXISTS xxl_job_logglue; -CREATE TABLE `xxl_job_logglue` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `job_id` int(11) NOT NULL COMMENT '任务,主键ID', - `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型', - `glue_source` mediumtext COMMENT 'GLUE源代码', - `glue_remark` varchar(128) NOT NULL COMMENT 'GLUE备注', - `add_time` datetime DEFAULT NULL, - `update_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `xxl_job_logglue` +( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `job_id` INT(11) NOT NULL COMMENT '任务,主键ID', + `glue_type` VARCHAR(50) DEFAULT NULL COMMENT 'GLUE类型', + `glue_source` MEDIUMTEXT COMMENT 'GLUE源代码', + `glue_remark` VARCHAR(128) NOT NULL COMMENT 'GLUE备注', + `add_time` DATETIME DEFAULT NULL, + `update_time` DATETIME DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='xxl_job_logglue'; -drop table IF EXISTS xxl_job_registry; -CREATE TABLE `xxl_job_registry` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `registry_group` varchar(50) NOT NULL, - `registry_key` varchar(255) NOT NULL, - `registry_value` varchar(255) NOT NULL, - `update_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `i_g_k_v` (`registry_group`,`registry_key`,`registry_value`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `xxl_job_registry` +( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `registry_group` VARCHAR(50) NOT NULL, + `registry_key` VARCHAR(255) NOT NULL, + `registry_value` VARCHAR(255) NOT NULL, + `update_time` DATETIME DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `i_g_k_v` (`registry_group`, `registry_key`, `registry_value`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='xxl_job_registry'; -drop table IF EXISTS xxl_job_group; -CREATE TABLE `xxl_job_group` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `app_name` varchar(64) NOT NULL COMMENT '执行器AppName', - `title` varchar(12) NOT NULL COMMENT '执行器名称', - `address_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '执行器地址类型:0=自动注册、1=手动录入', - `address_list` text COMMENT '执行器地址列表,多地址逗号分隔', - `update_time` datetime DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `xxl_job_group` +( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `app_name` VARCHAR(64) NOT NULL COMMENT '执行器AppName', + `title` VARCHAR(12) NOT NULL COMMENT '执行器名称', + `address_type` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '执行器地址类型:0=自动注册、1=手动录入', + `address_list` TEXT COMMENT '执行器地址列表,多地址逗号分隔', + `update_time` DATETIME DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='xxl_job_group'; -drop table IF EXISTS xxl_job_user; -CREATE TABLE `xxl_job_user` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `username` varchar(50) NOT NULL COMMENT '账号', - `password` varchar(50) NOT NULL COMMENT '密码', - `role` tinyint(4) NOT NULL COMMENT '角色:0-普通用户、1-管理员', - `permission` varchar(255) DEFAULT NULL COMMENT '权限:执行器ID列表,多个逗号分割', - PRIMARY KEY (`id`), - UNIQUE KEY `i_username` (`username`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `xxl_job_user` +( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `username` VARCHAR(50) NOT NULL COMMENT '账号', + `password` VARCHAR(50) NOT NULL COMMENT '密码', + `role` TINYINT(4) NOT NULL COMMENT '角色:0-普通用户、1-管理员', + `permission` VARCHAR(255) DEFAULT NULL COMMENT '权限:执行器ID列表,多个逗号分割', + PRIMARY KEY (`id`), + UNIQUE KEY `i_username` (`username`) USING BTREE +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='xxl_job_user'; -drop table IF EXISTS xxl_job_lock; -CREATE TABLE `xxl_job_lock` ( - `lock_name` varchar(50) NOT NULL COMMENT '锁名称', - PRIMARY KEY (`lock_name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE IF NOT EXISTS `xxl_job_lock` +( + `lock_name` VARCHAR(50) NOT NULL COMMENT '锁名称', + PRIMARY KEY (`lock_name`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='xxl_job_lock'; -INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `address_type`, `address_list`, `update_time`) VALUES (1, 'xxl-job-executor-sample', '示例执行器', 0, NULL, '2018-11-03 22:21:31' ); -INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (1, 1, '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'CRON', '0 0 0 * * ? *', 'DO_NOTHING', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', ''); -INSERT INTO `xxl_job_user`(`id`, `username`, `password`, `role`, `permission`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL); -INSERT INTO `xxl_job_lock` ( `lock_name`) VALUES ( 'schedule_lock'); +INSERT INTO `xxl_job_group` (`id`, `app_name`, `title`, `address_type`, `address_list`, `update_time`) +VALUES (1, 'xxl-job-executor-sample', '示例执行器', 0, NULL, '2018-11-03 22:21:31'); +INSERT INTO `xxl_job_info` (`id`, `job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, + `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, + `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, + `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, + `child_jobid`) +VALUES (1, 1, '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'CRON', '0 0 0 * * ? *', + 'DO_NOTHING', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', + '2018-11-03 22:21:31', ''); + +INSERT INTO xxl_job_user (id, username, password, role, permission) +VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL); + +INSERT INTO xxl_job_lock (lock_name) +VALUES ('schedule_lock'); \ No newline at end of file