update.sql 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. ###########################################################################
  2. # 该sql文件只用于版本升级,如果您执行init.sql文件的时间在如下时间之后,您可以忽略该文件
  3. # 否则您需要按照时间顺序选择性执行该文件中的sql语句
  4. ###########################################################################
  5. #20230621 配置表中的类名替换
  6. UPDATE big_screen_page SET config = REPLACE(config, '"className":"com.gccloud.bigscreen', '"className":"com.gccloud.dataroom');
  7. UPDATE big_screen_page SET config = REPLACE(config, '"className":"com.gccloud.dataroom.core.module.manage.dto.BigScreenPageDTO', '"className":"com.gccloud.dataroom.core.module.manage.dto.DataRoomPageDTO');
  8. #20230621 新增数据集相关的表
  9. DROP TABLE IF EXISTS `ds_category_tree`;
  10. CREATE TABLE `ds_category_tree` (
  11. `id` bigint(64) NOT NULL AUTO_INCREMENT COMMENT '主键',
  12. `ids` text COMMENT 'id序列',
  13. `name` varchar(255) DEFAULT NULL COMMENT '名称',
  14. `parent_id` bigint(64) DEFAULT NULL COMMENT '父级ID',
  15. `type` varchar(255) NOT NULL,
  16. `module_code` varchar(255) DEFAULT NULL,
  17. `update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  18. `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  19. `del_flag` tinyint(2) NOT NULL DEFAULT '0' COMMENT '删除标识',
  20. PRIMARY KEY (`id`) USING BTREE
  21. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据集种类树';
  22. DROP TABLE IF EXISTS `ds_datasource`;
  23. CREATE TABLE `ds_datasource` (
  24. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  25. `source_name` varchar(255) DEFAULT NULL COMMENT '数据源名称',
  26. `source_type` varchar(255) DEFAULT NULL COMMENT '数据源类型',
  27. `driver_class_name` varchar(255) DEFAULT NULL COMMENT '连接驱动',
  28. `url` varchar(255) DEFAULT NULL COMMENT '连接url',
  29. `host` varchar(255) DEFAULT NULL COMMENT '主机',
  30. `port` int(16) DEFAULT NULL COMMENT '端口',
  31. `username` varchar(255) DEFAULT NULL COMMENT '用户名',
  32. `password` text COMMENT '密码',
  33. `module_code` varchar(255) DEFAULT NULL COMMENT '模块编码',
  34. `editable` tinyint(2) DEFAULT '0' COMMENT '是否可编辑,0 不可编辑 1 可编辑',
  35. `remark` varchar(255) DEFAULT NULL,
  36. `update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  37. `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  38. `del_flag` tinyint(2) NOT NULL DEFAULT '0' COMMENT '删除标识',
  39. PRIMARY KEY (`id`) USING BTREE
  40. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='数据源配置表';
  41. DROP TABLE IF EXISTS `ds_dataset`;
  42. CREATE TABLE `ds_dataset` (
  43. `id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '主键',
  44. `name` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '名称',
  45. `code` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '编码',
  46. `type_id` varchar(255) DEFAULT NULL COMMENT '种类ID',
  47. `remark` text CHARACTER SET utf8 COMMENT '描述',
  48. `dataset_type` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT '数据集类型(自定义数据集 custom、模型数据集model、原始数据集original、API数据集api、JSON数据集 json)',
  49. `module_code` varchar(255) COLLATE utf8_general_mysql500_ci DEFAULT NULL COMMENT '模块编码',
  50. `editable` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否可编辑,0 不可编辑 1 可编辑',
  51. `source_id` bigint(32) DEFAULT NULL COMMENT '数据源ID',
  52. `cache` tinyint(1) DEFAULT 0 NOT NULL COMMENT '是否对执行结构缓存 0 不缓存 1 缓存',
  53. `config` longtext COMMENT '数据集配置',
  54. `update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  55. `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  56. `del_flag` tinyint(2) NOT NULL DEFAULT '0' COMMENT '删除标识',
  57. PRIMARY KEY (`id`) USING BTREE
  58. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_mysql500_ci COMMENT='数据集表';
  59. # 20230705 添加create_by、update_by
  60. ALTER TABLE `big_screen_page` ADD COLUMN `create_by` bigint(64) NULL DEFAULT 2 COMMENT '创建人' AFTER `del_flag`;
  61. ALTER TABLE `big_screen_page` ADD COLUMN `update_by` bigint(64) NULL DEFAULT 2 COMMENT '更新人' AFTER `create_by`;
  62. ALTER TABLE `big_screen_file` ADD COLUMN `create_by` bigint(64) NULL DEFAULT 2 COMMENT '创建人' AFTER `del_flag`;
  63. ALTER TABLE `big_screen_file` ADD COLUMN `update_by` bigint(64) NULL DEFAULT 2 COMMENT '更新人' AFTER `create_by`;
  64. ALTER TABLE `big_screen_biz_component` ADD COLUMN `create_by` bigint(64) NULL DEFAULT 2 COMMENT '创建人' AFTER `del_flag`;
  65. ALTER TABLE `big_screen_biz_component` ADD COLUMN `update_by` bigint(64) NULL DEFAULT 2 COMMENT '更新人' AFTER `create_by`;
  66. ALTER TABLE `big_screen_page_template` ADD COLUMN `create_by` bigint(64) NULL DEFAULT 2 COMMENT '创建人' AFTER `del_flag`;
  67. ALTER TABLE `big_screen_page_template` ADD COLUMN `update_by` bigint(64) NULL DEFAULT 2 COMMENT '更新人' AFTER `create_by`;
  68. ALTER TABLE `big_screen_type` ADD COLUMN `create_by` bigint(64) NULL DEFAULT 2 COMMENT '创建人' AFTER `del_flag`;
  69. ALTER TABLE `big_screen_type` ADD COLUMN `update_by` bigint(64) NULL DEFAULT 2 COMMENT '更新人' AFTER `create_by`;
  70. ALTER TABLE `ds_datasource` ADD COLUMN `create_by` bigint(64) NULL DEFAULT 2 COMMENT '创建人' AFTER `del_flag`;
  71. ALTER TABLE `ds_datasource` ADD COLUMN `update_by` bigint(64) NULL DEFAULT 2 COMMENT '更新人' AFTER `create_by`;
  72. ALTER TABLE `ds_dataset` ADD COLUMN `create_by` bigint(64) NULL DEFAULT 2 COMMENT '创建人' AFTER `del_flag`;
  73. ALTER TABLE `ds_dataset` ADD COLUMN `update_by` bigint(64) NULL DEFAULT 2 COMMENT '更新人' AFTER `create_by`;
  74. ALTER TABLE `ds_category_tree` ADD COLUMN `create_by` bigint(64) NULL DEFAULT 2 COMMENT '创建人' AFTER `del_flag`;
  75. ALTER TABLE `ds_category_tree` ADD COLUMN `update_by` bigint(64) NULL DEFAULT 2 COMMENT '更新人' AFTER `create_by`;
  76. # 20230710 添加数据集标签表
  77. DROP TABLE IF EXISTS `ds_label`;
  78. CREATE TABLE `ds_label` (
  79. `id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '主键',
  80. `label_name` varchar(255) DEFAULT NULL COMMENT '标签名称',
  81. `label_type` varchar(255) DEFAULT NULL COMMENT '标签类型',
  82. `label_desc` varchar(255) DEFAULT NULL COMMENT '标签描述',
  83. `update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  84. `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  85. `create_by` bigint(64) null default 2 comment '创建人',
  86. `update_by` bigint(64) null default 2 comment '更新人',
  87. `del_flag` tinyint(2) NOT NULL DEFAULT '0' COMMENT '删除标识',
  88. PRIMARY KEY (`id`) USING BTREE
  89. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_mysql500_ci COMMENT='标签';
  90. DROP TABLE IF EXISTS `ds_dataset_label`;
  91. CREATE TABLE `ds_dataset_label` (
  92. `id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '主键',
  93. `dataset_id` bigint(32) DEFAULT NULL COMMENT '数据集ID',
  94. `label_id` bigint(32) DEFAULT NULL COMMENT '标签ID',
  95. PRIMARY KEY (`id`) USING BTREE
  96. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_mysql500_ci COMMENT='数据集与标签关联表';
  97. # 20230710 数据源新增字段
  98. ALTER TABLE `ds_datasource` ADD COLUMN `table_name` varchar(255) DEFAULT NULL COMMENT '表名' AFTER `module_code`;
  99. # 20230907 新增地图数据维护表
  100. DROP TABLE IF EXISTS `big_screen_map`;
  101. CREATE TABLE `big_screen_map`
  102. (
  103. `id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '主键',
  104. `parent_id` varchar(255) DEFAULT NULL COMMENT '父级地图id',
  105. `map_code` varchar(255) DEFAULT NULL COMMENT '地图编码',
  106. `name` varchar(255) DEFAULT NULL COMMENT '地图名称',
  107. `geo_json` longtext DEFAULT NULL COMMENT '地图geoJson',
  108. `level` tinyint(2) NOT NULL DEFAULT 0 COMMENT '地图级别 0-世界 1-国家 2-省 3-市 4-区县',
  109. `uploaded_geo_json` tinyint(2) NOT NULL DEFAULT 0 COMMENT '是否已上传geoJson 0-否 1-是',
  110. `update_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  111. `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  112. `create_by` bigint(64) null default 2 comment '创建人',
  113. `update_by` bigint(64) null default 2 comment '更新人',
  114. `del_flag` tinyint(2) NOT NULL DEFAULT '0' COMMENT '删除标识',
  115. PRIMARY KEY (`id`) USING BTREE
  116. ) ENGINE = InnoDB
  117. DEFAULT CHARSET = utf8 COMMENT ='地图数据维护表';
  118. # 20230913 新增大屏页面预览缓存表
  119. DROP TABLE IF EXISTS `big_screen_page_preview`;
  120. CREATE TABLE `big_screen_page_preview`
  121. (
  122. `id` bigint(32) NOT NULL AUTO_INCREMENT COMMENT '主键',
  123. `code` varchar(255) NOT NULL DEFAULT '' COMMENT '页面编码,页面唯一标识符',
  124. `config` longtext COMMENT '页面配置',
  125. `create_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  126. PRIMARY KEY (`id`)
  127. ) ENGINE = InnoDB
  128. DEFAULT CHARSET = utf8mb4 COMMENT ='页面预览缓存表,每日定时删除';
  129. # 20231009 移除大屏页面表中的冗余字段
  130. alter table big_screen_page drop column icon;
  131. alter table big_screen_page drop column icon_color;
  132. alter table big_screen_page drop column layout;
  133. alter table big_screen_page drop column model_code;