mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-12 04:27:39 +00:00
[improvement](config) Add a switch to load the demo and update schema-mysql.sql
This commit is contained in:
@@ -31,6 +31,7 @@ import java.util.List;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
import org.springframework.boot.context.event.ApplicationReadyEvent;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -50,6 +51,8 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
|||||||
private PluginService pluginService;
|
private PluginService pluginService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AgentService agentService;
|
private AgentService agentService;
|
||||||
|
@Value("${spring.h2.demo.enabled:false}")
|
||||||
|
private boolean demoEnable;
|
||||||
|
|
||||||
private void parseAndExecute(int chatId, String queryText) throws Exception {
|
private void parseAndExecute(int chatId, String queryText) throws Exception {
|
||||||
QueryReq queryRequest = new QueryReq();
|
QueryReq queryRequest = new QueryReq();
|
||||||
@@ -231,6 +234,9 @@ public class ConfigureDemo implements ApplicationListener<ApplicationReadyEvent>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) {
|
||||||
|
if (!demoEnable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
addDemoChatConfig_1();
|
addDemoChatConfig_1();
|
||||||
addDemoChatConfig_2();
|
addDemoChatConfig_2();
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ spring:
|
|||||||
path: /h2-console/semantic
|
path: /h2-console/semantic
|
||||||
# enabled web
|
# enabled web
|
||||||
enabled: true
|
enabled: true
|
||||||
|
demo:
|
||||||
|
enabled: true
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: org.h2.Driver
|
driver-class-name: org.h2.Driver
|
||||||
schema: classpath:db/schema-h2.sql
|
schema: classpath:db/schema-h2.sql
|
||||||
|
|||||||
@@ -1,327 +1,373 @@
|
|||||||
create table supersonic_sit.s2_auth_groups
|
CREATE TABLE `s2_agent` (
|
||||||
(
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
group_id int not null
|
`name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
primary key,
|
`description` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
config varchar(2048) null
|
`examples` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
)
|
`status` int(11) DEFAULT NULL,
|
||||||
collate = utf8mb4_unicode_ci;
|
`model` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`config` varchar(6000) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`created_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`created_at` datetime DEFAULT NULL,
|
||||||
|
`updated_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`updated_at` datetime DEFAULT NULL,
|
||||||
|
`enable_search` int(11) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
create table supersonic_sit.s2_available_date_info
|
CREATE TABLE `s2_auth_groups` (
|
||||||
(
|
`group_id` int(11) NOT NULL,
|
||||||
id int auto_increment
|
`config` varchar(2048) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||||
primary key,
|
PRIMARY KEY (`group_id`)
|
||||||
item_id int not null,
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
type varchar(255) not null,
|
|
||||||
date_format varchar(64) not null,
|
|
||||||
start_date varchar(64) null,
|
|
||||||
end_date varchar(64) null,
|
|
||||||
unavailable_date text null,
|
|
||||||
created_at timestamp default CURRENT_TIMESTAMP not null,
|
|
||||||
created_by varchar(100) not null,
|
|
||||||
updated_at timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
|
||||||
updated_by varchar(100) not null,
|
|
||||||
status int default 0 null
|
|
||||||
)
|
|
||||||
collate = utf8mb4_unicode_ci;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_chat
|
|
||||||
(
|
|
||||||
chat_id bigint(8) auto_increment
|
|
||||||
primary key,
|
|
||||||
chat_name varchar(100) null,
|
|
||||||
create_time datetime null,
|
|
||||||
last_time datetime null,
|
|
||||||
creator varchar(30) null,
|
|
||||||
last_question varchar(200) null,
|
|
||||||
is_delete int(2) default 0 null comment 'is deleted',
|
|
||||||
is_top int(2) default 0 null comment 'is top'
|
|
||||||
)
|
|
||||||
charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_chat_config
|
|
||||||
(
|
|
||||||
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
|
||||||
`domain_id` bigint(20) DEFAULT NULL COMMENT '主题域id',
|
|
||||||
`chat_detail_config` mediumtext COMMENT '明细模式配置信息',
|
|
||||||
`chat_agg_config` mediumtext COMMENT '指标模式配置信息',
|
|
||||||
`recommended_questions` mediumtext COMMENT '推荐问题配置',
|
|
||||||
`created_at` datetime NOT NULL COMMENT '创建时间',
|
|
||||||
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
|
||||||
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
|
||||||
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
|
||||||
`status` int(10) NOT NULL COMMENT '主题域扩展信息状态, 0-删除,1-生效',
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
)
|
|
||||||
comment '主题域扩展信息表' charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_chat_context
|
|
||||||
(
|
|
||||||
chat_id bigint not null comment 'context chat id'
|
|
||||||
primary key,
|
|
||||||
modified_at datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment 'row modify time',
|
|
||||||
user varchar(64) null comment 'row modify user',
|
|
||||||
query_text text null comment 'query text',
|
|
||||||
semantic_parse text null comment 'parse data',
|
|
||||||
ext_data text null comment 'extend data'
|
|
||||||
)
|
|
||||||
charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_chat_query
|
|
||||||
(
|
|
||||||
question_id bigint auto_increment
|
|
||||||
primary key,
|
|
||||||
create_time timestamp default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP,
|
|
||||||
query_text mediumtext null,
|
|
||||||
user_name varchar(150) null,
|
|
||||||
query_state int(1) null,
|
|
||||||
chat_id bigint not null,
|
|
||||||
query_response mediumtext not null,
|
|
||||||
score int default 0 null,
|
|
||||||
feedback varchar(1024) default '' null
|
|
||||||
)
|
|
||||||
charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_database
|
|
||||||
(
|
|
||||||
id bigint auto_increment
|
|
||||||
primary key,
|
|
||||||
domain_id bigint not null comment '主题域ID',
|
|
||||||
name varchar(255) not null comment '名称',
|
|
||||||
description varchar(500) null comment '描述',
|
|
||||||
version varchar(64) null comment '版本',
|
|
||||||
type varchar(20) not null comment '类型 mysql,clickhouse,tdw',
|
|
||||||
config text not null comment '配置信息',
|
|
||||||
created_at datetime not null comment '创建时间',
|
|
||||||
created_by varchar(100) not null comment '创建人',
|
|
||||||
updated_at datetime not null comment '更新时间',
|
|
||||||
updated_by varchar(100) not null comment '更新人'
|
|
||||||
)
|
|
||||||
comment '数据库实例表' charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_datasource
|
|
||||||
(
|
|
||||||
id bigint auto_increment
|
|
||||||
primary key,
|
|
||||||
domain_id bigint not null comment '主题域ID',
|
|
||||||
name varchar(255) not null comment '数据源名称',
|
|
||||||
biz_name varchar(255) not null comment '内部名称',
|
|
||||||
description varchar(500) null comment '数据源描述',
|
|
||||||
database_id bigint not null comment '数据库实例ID',
|
|
||||||
datasource_detail mediumtext not null comment '数据源配置',
|
|
||||||
created_at datetime not null comment '创建时间',
|
|
||||||
created_by varchar(100) not null comment '创建人',
|
|
||||||
updated_at datetime not null comment '更新时间',
|
|
||||||
updated_by varchar(100) not null comment '更新人'
|
|
||||||
)
|
|
||||||
charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_datasource_rela
|
|
||||||
(
|
|
||||||
id bigint auto_increment
|
|
||||||
primary key,
|
|
||||||
domain_id bigint null,
|
|
||||||
datasource_from bigint null,
|
|
||||||
datasource_to bigint null,
|
|
||||||
join_key varchar(100) null,
|
|
||||||
created_at datetime null,
|
|
||||||
created_by varchar(100) null,
|
|
||||||
updated_at datetime null,
|
|
||||||
updated_by varchar(100) null
|
|
||||||
)
|
|
||||||
charset = utf8;
|
|
||||||
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_dimension
|
CREATE TABLE `s2_available_date_info` (
|
||||||
(
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
id bigint auto_increment comment '维度ID'
|
`item_id` int(11) NOT NULL,
|
||||||
primary key,
|
`type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
domain_id bigint not null comment '主题域id',
|
`date_format` varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
datasource_id bigint not null comment '所属数据源id',
|
`date_period` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||||
name varchar(255) not null comment '维度名称',
|
`start_date` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||||
biz_name varchar(255) not null comment '字段名称',
|
`end_date` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||||
description varchar(500) not null comment '描述',
|
`unavailable_date` text COLLATE utf8mb4_unicode_ci,
|
||||||
status int(10) not null comment '维度状态,0正常,1下架,2删除',
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
sensitive_level int(10) null comment '敏感级别',
|
`created_by` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
type varchar(50) not null comment '维度类型 categorical,time',
|
`updated_at` timestamp NULL,
|
||||||
type_params text null comment '类型参数',
|
`updated_by` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
expr text not null comment '表达式',
|
`status` int(11) DEFAULT '0',
|
||||||
created_at datetime not null comment '创建时间',
|
PRIMARY KEY (`id`)
|
||||||
created_by varchar(100) not null comment '创建人',
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
updated_at datetime not null comment '更新时间',
|
|
||||||
updated_by varchar(100) not null comment '更新人',
|
|
||||||
semantic_type varchar(20) not null comment '语义类型DATE, ID, CATEGORY',
|
|
||||||
alias varchar(500) collate utf8_unicode_ci null,
|
|
||||||
default_values varchar(500) DEFAULT NULL,
|
|
||||||
dim_value_maps varchar(500) DEFAULT NULL
|
|
||||||
)
|
|
||||||
comment '维度表' charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_domain
|
|
||||||
(
|
|
||||||
id bigint auto_increment comment '自增ID'
|
|
||||||
primary key,
|
|
||||||
name varchar(255) null comment '主题域名称',
|
|
||||||
biz_name varchar(255) null comment '内部名称',
|
|
||||||
parent_id bigint default 0 null comment '父主题域ID',
|
|
||||||
status int(10) not null comment '主题域状态',
|
|
||||||
created_at datetime null comment '创建时间',
|
|
||||||
created_by varchar(100) null comment '创建人',
|
|
||||||
updated_at datetime null comment '更新时间',
|
|
||||||
updated_by varchar(100) null comment '更新人',
|
|
||||||
admin varchar(3000) null comment '主题域管理员',
|
|
||||||
admin_org varchar(3000) null comment '主题域管理员组织',
|
|
||||||
is_open int null comment '主题域是否公开',
|
|
||||||
viewer varchar(3000) null comment '主题域可用用户',
|
|
||||||
view_org varchar(3000) null comment '主题域可用组织',
|
|
||||||
entity varchar(500) DEFAULT NULL COMMENT '主题域实体信息'
|
|
||||||
)
|
|
||||||
comment '主题域基础信息表' charset = utf8;
|
|
||||||
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_domain_extend
|
CREATE TABLE `s2_chat` (
|
||||||
(
|
`chat_id` bigint(8) NOT NULL AUTO_INCREMENT,
|
||||||
id bigint unsigned auto_increment
|
`agent_id` int(11) DEFAULT NULL,
|
||||||
primary key,
|
`chat_name` varchar(300) DEFAULT NULL,
|
||||||
domain_id bigint null comment '主题域id',
|
`create_time` datetime DEFAULT NULL,
|
||||||
default_metrics varchar(655) null comment '默认指标',
|
`last_time` datetime DEFAULT NULL,
|
||||||
visibility mediumtext null comment '不可见的维度/指标信息',
|
`creator` varchar(30) DEFAULT NULL,
|
||||||
entity_info mediumtext null comment '实体信息',
|
`last_question` varchar(200) DEFAULT NULL,
|
||||||
dictionary_info mediumtext null comment '字典相关的维度设置信息',
|
`is_delete` int(2) DEFAULT '0' COMMENT 'is deleted',
|
||||||
created_at datetime not null comment '创建时间',
|
`is_top` int(2) DEFAULT '0' COMMENT 'is top',
|
||||||
updated_at datetime not null comment '更新时间',
|
PRIMARY KEY (`chat_id`)
|
||||||
created_by varchar(100) not null comment '创建人',
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
updated_by varchar(100) not null comment '更新人',
|
|
||||||
status int(10) not null comment '主题域扩展信息状态, 0-删除,1-生效'
|
|
||||||
)
|
|
||||||
comment '主题域扩展信息表' collate = utf8mb4_unicode_ci;
|
|
||||||
|
|
||||||
|
CREATE TABLE `s2_chat_config` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`model_id` bigint(20) DEFAULT NULL,
|
||||||
|
`chat_detail_config` mediumtext COMMENT '明细模式配置信息',
|
||||||
|
`chat_agg_config` mediumtext COMMENT '指标模式配置信息',
|
||||||
|
`recommended_questions` mediumtext COMMENT '推荐问题配置',
|
||||||
|
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||||
|
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||||
|
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||||
|
`status` int(10) NOT NULL COMMENT '主题域扩展信息状态, 0-删除,1-生效',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='主题域扩展信息表';
|
||||||
|
|
||||||
create table supersonic_sit.s2_metric
|
CREATE TABLE `s2_chat_context` (
|
||||||
(
|
`chat_id` bigint(20) NOT NULL COMMENT 'context chat id',
|
||||||
id bigint auto_increment
|
`modified_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'row modify time',
|
||||||
primary key,
|
`user` varchar(64) DEFAULT NULL COMMENT 'row modify user',
|
||||||
domain_id bigint not null comment '主体域ID',
|
`query_text` text COMMENT 'query text',
|
||||||
name varchar(255) not null comment '指标名称',
|
`semantic_parse` text COMMENT 'parse data',
|
||||||
biz_name varchar(255) not null comment '字段名称',
|
`ext_data` text COMMENT 'extend data',
|
||||||
description varchar(500) null comment '描述',
|
PRIMARY KEY (`chat_id`)
|
||||||
status int(10) not null comment '指标状态,0正常,1下架,2删除',
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
sensitive_level int(10) not null comment '敏感级别',
|
|
||||||
type varchar(50) not null comment '指标类型 proxy,expr',
|
|
||||||
type_params text not null comment '类型参数',
|
|
||||||
created_at datetime not null comment '创建时间',
|
|
||||||
created_by varchar(100) not null comment '创建人',
|
|
||||||
updated_at datetime not null comment '更新时间',
|
|
||||||
updated_by varchar(100) not null comment '更新人',
|
|
||||||
data_format_type varchar(50) null comment '数值类型',
|
|
||||||
data_format varchar(500) null comment '数值类型参数',
|
|
||||||
alias varchar(500) collate utf8_unicode_ci null
|
|
||||||
)
|
|
||||||
comment '指标表' charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_query_stat_info
|
|
||||||
(
|
|
||||||
id bigint unsigned auto_increment
|
|
||||||
primary key,
|
|
||||||
trace_id varchar(200) null comment '查询标识',
|
|
||||||
domain_id bigint null comment '主题域ID',
|
|
||||||
user varchar(200) null comment '执行sql的用户',
|
|
||||||
created_at datetime default CURRENT_TIMESTAMP null comment '创建时间',
|
|
||||||
query_type varchar(200) null comment '查询对应的场景',
|
|
||||||
query_type_back int(10) default 0 null comment '查询类型, 0-正常查询, 1-预刷类型',
|
|
||||||
query_sql_cmd mediumtext null comment '对应查询的struct',
|
|
||||||
sql_cmd_md5 varchar(200) null comment 'sql md5值',
|
|
||||||
query_struct_cmd mediumtext null comment '对应查询的struct',
|
|
||||||
struct_cmd_md5 varchar(200) null comment 'sql md5值',
|
|
||||||
`sql` mediumtext null comment '对应查询的sql',
|
|
||||||
sql_md5 varchar(200) null comment 'sql md5值',
|
|
||||||
query_engine varchar(20) null comment '查询引擎',
|
|
||||||
elapsed_ms bigint(10) null comment '查询耗时',
|
|
||||||
query_state varchar(20) null comment '查询最终状态',
|
|
||||||
native_query int(10) null comment '1-明细查询,0-聚合查询',
|
|
||||||
start_date varchar(50) null comment 'sql开始日期',
|
|
||||||
end_date varchar(50) null comment 'sql结束日期',
|
|
||||||
dimensions mediumtext null comment 'sql 涉及的维度',
|
|
||||||
metrics mediumtext null comment 'sql 涉及的指标',
|
|
||||||
select_cols mediumtext null comment 'sql select部分涉及的标签',
|
|
||||||
agg_cols mediumtext null comment 'sql agg部分涉及的标签',
|
|
||||||
filter_cols mediumtext null comment 'sql where部分涉及的标签',
|
|
||||||
group_by_cols mediumtext null comment 'sql grouy by部分涉及的标签',
|
|
||||||
order_by_cols mediumtext null comment 'sql order by部分涉及的标签',
|
|
||||||
use_result_cache tinyint(1) default -1 null comment '是否命中sql缓存',
|
|
||||||
use_sql_cache tinyint(1) default -1 null comment '是否命中sql缓存',
|
|
||||||
sql_cache_key mediumtext null comment '缓存的key',
|
|
||||||
result_cache_key mediumtext null comment '缓存的key'
|
|
||||||
)
|
|
||||||
comment '查询统计信息表' collate = utf8mb4_unicode_ci;
|
|
||||||
|
|
||||||
create index domain_index
|
|
||||||
on supersonic_sit.s2_query_stat_info (domain_id);
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_semantic_pasre_info
|
|
||||||
(
|
|
||||||
id bigint unsigned auto_increment
|
|
||||||
primary key,
|
|
||||||
trace_id varchar(200) not null comment '查询标识',
|
|
||||||
domain_id bigint not null comment '主体域ID',
|
|
||||||
dimensions mediumtext null comment '查询相关的维度信息',
|
|
||||||
metrics mediumtext null comment '查询相关的指标信息',
|
|
||||||
orders mediumtext null comment '查询相关的排序信息',
|
|
||||||
filters mediumtext null comment '查询相关的过滤信息',
|
|
||||||
date_info mediumtext null comment '查询相关的日期信息',
|
|
||||||
`limit` bigint not null comment '查询相关的limit信息',
|
|
||||||
native_query tinyint(1) default 0 not null comment '1-明细查询,0-聚合查询',
|
|
||||||
`sql` mediumtext null comment '解析后的sql',
|
|
||||||
created_at datetime not null comment '创建时间',
|
|
||||||
created_by varchar(100) not null comment '创建人',
|
|
||||||
status int(10) not null comment '运行状态',
|
|
||||||
elapsed_ms bigint(10) null comment 'sql解析耗时'
|
|
||||||
) comment '语义层sql解析信息表' charset = utf8;
|
|
||||||
|
|
||||||
create table supersonic_sit.s2_view_info
|
|
||||||
(
|
|
||||||
id bigint auto_increment
|
|
||||||
primary key,
|
|
||||||
domain_id bigint null,
|
|
||||||
type varchar(20) null comment 'datasource、dimension、metric',
|
|
||||||
config text null comment 'config detail',
|
|
||||||
created_at datetime null,
|
|
||||||
created_by varchar(100) null,
|
|
||||||
updated_at datetime null,
|
|
||||||
updated_by varchar(100) not null
|
|
||||||
) charset = utf8;
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `s2_user` (
|
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`name` varchar(100) NOT NULL,
|
|
||||||
`display_name` varchar(100) DEFAULT NULL,
|
|
||||||
`password` varchar(100) DEFAULT NULL,
|
|
||||||
`email` varchar(100) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE s2_chat_statistics (
|
|
||||||
`question_id` BIGINT NOT NULL,
|
|
||||||
`chat_id` BIGINT NOT NULL ,
|
|
||||||
`user_name` varchar(150) DEFAULT NULL COMMENT '',
|
|
||||||
`query_text` varchar(200),
|
|
||||||
`interface_name` varchar(100) DEFAULT NULL COMMENT '',
|
|
||||||
`cost` INT(6) DEFAULT 0 ,
|
|
||||||
`type` INT DEFAULT NULL ,
|
|
||||||
`create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
||||||
index `commonIndex` (`question_id`)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE `s2_chat_parse` (
|
CREATE TABLE `s2_chat_parse` (
|
||||||
`question_id` bigint(20) NOT NULL,
|
`question_id` bigint(20) NOT NULL,
|
||||||
`chat_id` bigint(20) NOT NULL,
|
`chat_id` bigint(20) NOT NULL,
|
||||||
`parse_id` int(11) NOT NULL,
|
`parse_id` int(11) NOT NULL,
|
||||||
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
`query_text` varchar(500) DEFAULT NULL,
|
`query_text` varchar(500) DEFAULT NULL,
|
||||||
`user_name` varchar(150) DEFAULT NULL,
|
`user_name` varchar(150) DEFAULT NULL,
|
||||||
`parse_info` mediumtext NOT NULL,
|
`parse_info` mediumtext NOT NULL,
|
||||||
`is_candidate` int DEFAULT 1 COMMENT '1是candidate,0是selected',
|
`is_candidate` int(11) DEFAULT '1' COMMENT '1是candidate,0是selected',
|
||||||
index `commonIndex` (`question_id`)
|
KEY `commonIndex` (`question_id`)
|
||||||
)
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `s2_chat_query` (
|
||||||
|
`question_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`agent_id` int(11) DEFAULT NULL,
|
||||||
|
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
`query_text` mediumtext,
|
||||||
|
`user_name` varchar(150) DEFAULT NULL,
|
||||||
|
`query_state` int(1) DEFAULT NULL,
|
||||||
|
`chat_id` bigint(20) NOT NULL,
|
||||||
|
`query_result` mediumtext,
|
||||||
|
`score` int(11) DEFAULT '0',
|
||||||
|
`feedback` varchar(1024) DEFAULT '',
|
||||||
|
PRIMARY KEY (`question_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `s2_chat_statistics` (
|
||||||
|
`question_id` bigint(20) NOT NULL,
|
||||||
|
`chat_id` bigint(20) NOT NULL,
|
||||||
|
`user_name` varchar(150) DEFAULT NULL,
|
||||||
|
`query_text` varchar(200) DEFAULT NULL,
|
||||||
|
`interface_name` varchar(100) DEFAULT NULL,
|
||||||
|
`cost` int(6) DEFAULT '0',
|
||||||
|
`type` int(11) DEFAULT NULL,
|
||||||
|
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
KEY `commonIndex` (`question_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
|
CREATE TABLE `s2_database` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) NOT NULL COMMENT '名称',
|
||||||
|
`description` varchar(500) DEFAULT NULL COMMENT '描述',
|
||||||
|
`version` varchar(64) DEFAULT NULL,
|
||||||
|
`type` varchar(20) NOT NULL COMMENT '类型 mysql,clickhouse,tdw',
|
||||||
|
`config` text NOT NULL COMMENT '配置信息',
|
||||||
|
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||||
|
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||||
|
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||||
|
`admin` varchar(500) DEFAULT NULL,
|
||||||
|
`viewer` varchar(500) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据库实例表';
|
||||||
|
|
||||||
|
CREATE TABLE `s2_datasource` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`model_id` bigint(20) DEFAULT NULL,
|
||||||
|
`name` varchar(255) NOT NULL COMMENT '数据源名称',
|
||||||
|
`biz_name` varchar(255) NOT NULL COMMENT '内部名称',
|
||||||
|
`agg_time` varchar(32) DEFAULT 'day',
|
||||||
|
`description` varchar(500) DEFAULT NULL COMMENT '数据源描述',
|
||||||
|
`database_id` bigint(20) NOT NULL COMMENT '数据库实例ID',
|
||||||
|
`datasource_detail` mediumtext NOT NULL COMMENT '数据源配置',
|
||||||
|
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||||
|
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||||
|
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE `s2_datasource_rela` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`model_id` bigint(20) DEFAULT NULL,
|
||||||
|
`datasource_from` bigint(20) DEFAULT NULL,
|
||||||
|
`datasource_to` bigint(20) DEFAULT NULL,
|
||||||
|
`join_key` varchar(100) DEFAULT NULL,
|
||||||
|
`created_at` datetime DEFAULT NULL,
|
||||||
|
`created_by` varchar(100) DEFAULT NULL,
|
||||||
|
`updated_at` datetime DEFAULT NULL,
|
||||||
|
`updated_by` varchar(100) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
CREATE TABLE `s2_dictionary` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`item_id` bigint(20) DEFAULT NULL COMMENT '对应维度id、指标id等',
|
||||||
|
`type` varchar(50) DEFAULT NULL COMMENT '对应维度、指标等',
|
||||||
|
`black_list` mediumtext COMMENT '字典黑名单',
|
||||||
|
`white_list` mediumtext COMMENT '字典白名单',
|
||||||
|
`rule_list` mediumtext COMMENT '字典规则',
|
||||||
|
`is_dict_Info` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1-开启写入字典,0-不开启',
|
||||||
|
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||||
|
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||||
|
`updated_by` varchar(100) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1-删除,0-可用',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='字典配置信息表';
|
||||||
|
|
||||||
|
CREATE TABLE `s2_dictionary_task` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务名称',
|
||||||
|
`description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '任务描述',
|
||||||
|
`command` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务请求参数',
|
||||||
|
`command_md5` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '任务请求参数',
|
||||||
|
`status` int(10) NOT NULL COMMENT '任务最终运行状态',
|
||||||
|
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`created_by` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '创建人',
|
||||||
|
`progress` double(3,2) DEFAULT '0.00' COMMENT '任务进度',
|
||||||
|
`elapsed_ms` bigint(10) DEFAULT NULL COMMENT '任务耗时',
|
||||||
|
`message` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '备注相关信息',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='字典任务信息表';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `s2_dimension` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '维度ID',
|
||||||
|
`model_id` bigint(20) DEFAULT NULL,
|
||||||
|
`datasource_id` bigint(20) NOT NULL COMMENT '所属数据源id',
|
||||||
|
`name` varchar(255) NOT NULL COMMENT '维度名称',
|
||||||
|
`biz_name` varchar(255) NOT NULL COMMENT '字段名称',
|
||||||
|
`description` varchar(500) NOT NULL COMMENT '描述',
|
||||||
|
`status` int(10) NOT NULL COMMENT '维度状态,0正常,1下架,2删除',
|
||||||
|
`sensitive_level` int(10) DEFAULT NULL COMMENT '敏感级别',
|
||||||
|
`type` varchar(50) NOT NULL COMMENT '维度类型 categorical,time',
|
||||||
|
`type_params` text COMMENT '类型参数',
|
||||||
|
`expr` text NOT NULL COMMENT '表达式',
|
||||||
|
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||||
|
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||||
|
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||||
|
`semantic_type` varchar(20) NOT NULL COMMENT '语义类型DATE, ID, CATEGORY',
|
||||||
|
`alias` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`default_values` varchar(500) DEFAULT NULL,
|
||||||
|
`dim_value_maps` varchar(5000) DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='维度表';
|
||||||
|
|
||||||
|
CREATE TABLE `s2_domain` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增ID',
|
||||||
|
`name` varchar(255) DEFAULT NULL COMMENT '主题域名称',
|
||||||
|
`biz_name` varchar(255) DEFAULT NULL COMMENT '内部名称',
|
||||||
|
`parent_id` bigint(20) DEFAULT '0' COMMENT '父主题域ID',
|
||||||
|
`status` int(10) NOT NULL COMMENT '主题域状态',
|
||||||
|
`created_at` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`created_by` varchar(100) DEFAULT NULL COMMENT '创建人',
|
||||||
|
`updated_at` datetime DEFAULT NULL COMMENT '更新时间',
|
||||||
|
`updated_by` varchar(100) DEFAULT NULL COMMENT '更新人',
|
||||||
|
`admin` varchar(3000) DEFAULT NULL COMMENT '主题域管理员',
|
||||||
|
`admin_org` varchar(3000) DEFAULT NULL COMMENT '主题域管理员组织',
|
||||||
|
`is_open` int(11) DEFAULT NULL COMMENT '主题域是否公开',
|
||||||
|
`viewer` varchar(3000) DEFAULT NULL COMMENT '主题域可用用户',
|
||||||
|
`view_org` varchar(3000) DEFAULT NULL COMMENT '主题域可用组织',
|
||||||
|
`entity` varchar(500) DEFAULT NULL COMMENT '主题域实体信息',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='主题域基础信息表';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `s2_metric` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`model_id` bigint(20) DEFAULT NULL,
|
||||||
|
`name` varchar(255) NOT NULL COMMENT '指标名称',
|
||||||
|
`biz_name` varchar(255) NOT NULL COMMENT '字段名称',
|
||||||
|
`description` varchar(500) DEFAULT NULL COMMENT '描述',
|
||||||
|
`status` int(10) NOT NULL COMMENT '指标状态,0正常,1下架,2删除',
|
||||||
|
`sensitive_level` int(10) NOT NULL COMMENT '敏感级别',
|
||||||
|
`type` varchar(50) NOT NULL COMMENT '指标类型 proxy,expr',
|
||||||
|
`type_params` text NOT NULL COMMENT '类型参数',
|
||||||
|
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||||
|
`updated_at` datetime NOT NULL COMMENT '更新时间',
|
||||||
|
`updated_by` varchar(100) NOT NULL COMMENT '更新人',
|
||||||
|
`data_format_type` varchar(50) DEFAULT NULL COMMENT '数值类型',
|
||||||
|
`data_format` varchar(500) DEFAULT NULL COMMENT '数值类型参数',
|
||||||
|
`alias` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='指标表';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `s2_model` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`biz_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`domain_id` bigint(20) DEFAULT NULL,
|
||||||
|
`alias` varchar(200) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`viewer` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`view_org` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`admin` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`admin_org` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`is_open` int(11) DEFAULT NULL,
|
||||||
|
`created_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`created_at` datetime DEFAULT NULL,
|
||||||
|
`updated_by` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`updated_at` datetime DEFAULT NULL,
|
||||||
|
`entity` text COLLATE utf8_unicode_ci,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE `s2_plugin` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`type` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'DASHBOARD,WIDGET,URL',
|
||||||
|
`model` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||||
|
`pattern` varchar(500) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`parse_mode` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||||
|
`parse_mode_config` text COLLATE utf8mb4_unicode_ci,
|
||||||
|
`name` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`created_at` datetime DEFAULT NULL,
|
||||||
|
`created_by` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`updated_at` datetime DEFAULT NULL,
|
||||||
|
`updated_by` varchar(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL,
|
||||||
|
`config` text CHARACTER SET utf8 COLLATE utf8_unicode_ci,
|
||||||
|
`comment` text COLLATE utf8mb4_unicode_ci,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE `s2_query_stat_info` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`trace_id` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查询标识',
|
||||||
|
`model_id` bigint(20) DEFAULT NULL,
|
||||||
|
`user` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '执行sql的用户',
|
||||||
|
`created_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`query_type` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查询对应的场景',
|
||||||
|
`query_type_back` int(10) DEFAULT '0' COMMENT '查询类型, 0-正常查询, 1-预刷类型',
|
||||||
|
`query_sql_cmd` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '对应查询的struct',
|
||||||
|
`sql_cmd_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
||||||
|
`query_struct_cmd` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '对应查询的struct',
|
||||||
|
`struct_cmd_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
||||||
|
`sql` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '对应查询的sql',
|
||||||
|
`sql_md5` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql md5值',
|
||||||
|
`query_engine` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查询引擎',
|
||||||
|
`elapsed_ms` bigint(10) DEFAULT NULL COMMENT '查询耗时',
|
||||||
|
`query_state` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '查询最终状态',
|
||||||
|
`native_query` int(10) DEFAULT NULL COMMENT '1-明细查询,0-聚合查询',
|
||||||
|
`start_date` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql开始日期',
|
||||||
|
`end_date` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'sql结束日期',
|
||||||
|
`dimensions` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'sql 涉及的维度',
|
||||||
|
`metrics` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'sql 涉及的指标',
|
||||||
|
`select_cols` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'sql select部分涉及的标签',
|
||||||
|
`agg_cols` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'sql agg部分涉及的标签',
|
||||||
|
`filter_cols` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'sql where部分涉及的标签',
|
||||||
|
`group_by_cols` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'sql grouy by部分涉及的标签',
|
||||||
|
`order_by_cols` mediumtext COLLATE utf8mb4_unicode_ci COMMENT 'sql order by部分涉及的标签',
|
||||||
|
`use_result_cache` tinyint(1) DEFAULT '-1' COMMENT '是否命中sql缓存',
|
||||||
|
`use_sql_cache` tinyint(1) DEFAULT '-1' COMMENT '是否命中sql缓存',
|
||||||
|
`sql_cache_key` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '缓存的key',
|
||||||
|
`result_cache_key` mediumtext COLLATE utf8mb4_unicode_ci COMMENT '缓存的key',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `domain_index` (`model_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='查询统计信息表';
|
||||||
|
|
||||||
|
CREATE TABLE `s2_semantic_pasre_info` (
|
||||||
|
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
|
`trace_id` varchar(200) NOT NULL COMMENT '查询标识',
|
||||||
|
`domain_id` bigint(20) NOT NULL COMMENT '主体域ID',
|
||||||
|
`dimensions` mediumtext COMMENT '查询相关的维度信息',
|
||||||
|
`metrics` mediumtext COMMENT '查询相关的指标信息',
|
||||||
|
`orders` mediumtext COMMENT '查询相关的排序信息',
|
||||||
|
`filters` mediumtext COMMENT '查询相关的过滤信息',
|
||||||
|
`date_info` mediumtext COMMENT '查询相关的日期信息',
|
||||||
|
`limit` bigint(20) NOT NULL COMMENT '查询相关的limit信息',
|
||||||
|
`native_query` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1-明细查询,0-聚合查询',
|
||||||
|
`sql` mediumtext COMMENT '解析后的sql',
|
||||||
|
`created_at` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`created_by` varchar(100) NOT NULL COMMENT '创建人',
|
||||||
|
`status` int(10) NOT NULL COMMENT '运行状态',
|
||||||
|
`elapsed_ms` bigint(10) DEFAULT NULL COMMENT 'sql解析耗时',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='语义层sql解析信息表';
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE `s2_view_info` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`model_id` bigint(20) DEFAULT NULL,
|
||||||
|
`type` varchar(20) DEFAULT NULL COMMENT 'datasource、dimension、metric',
|
||||||
|
`config` text COMMENT 'config detail',
|
||||||
|
`created_at` datetime DEFAULT NULL,
|
||||||
|
`created_by` varchar(100) DEFAULT NULL,
|
||||||
|
`updated_at` datetime DEFAULT NULL,
|
||||||
|
`updated_by` varchar(100) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
create table s2_user
|
||||||
|
(
|
||||||
|
id int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
name varchar(100) not null,
|
||||||
|
display_name varchar(100) null,
|
||||||
|
password varchar(100) null,
|
||||||
|
email varchar(100) null,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into s2_user (id, `name`, password, display_name, email) values (1, 'admin','admin','admin','admin@xx.com');
|
||||||
|
|||||||
Reference in New Issue
Block a user