diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/ChartDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/ChartDO.java index 2c233cb66..9d43fdedd 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/ChartDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/ChartDO.java @@ -18,7 +18,7 @@ */ @Getter @Setter -@TableName("CHART") +@TableName("chart") public class ChartDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +26,7 @@ public class ChartDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DashboardChartRelationDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DashboardChartRelationDO.java index 802a2e940..7b816176c 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DashboardChartRelationDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DashboardChartRelationDO.java @@ -18,7 +18,7 @@ */ @Getter @Setter -@TableName("DASHBOARD_CHART_RELATION") +@TableName("dashboard_chart_relation") public class DashboardChartRelationDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +26,7 @@ public class DashboardChartRelationDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DashboardDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DashboardDO.java index 5d4cd4df0..f7d525a46 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DashboardDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DashboardDO.java @@ -18,7 +18,7 @@ */ @Getter @Setter -@TableName("DASHBOARD") +@TableName("dashboard") public class DashboardDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +26,7 @@ public class DashboardDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DataSourceAccessDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DataSourceAccessDO.java index 121b12abf..a168926d9 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DataSourceAccessDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DataSourceAccessDO.java @@ -18,7 +18,7 @@ */ @Getter @Setter -@TableName("DATA_SOURCE_ACCESS") +@TableName("data_source_access") public class DataSourceAccessDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +26,7 @@ public class DataSourceAccessDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DataSourceDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DataSourceDO.java index c01cbb900..370c23232 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DataSourceDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DataSourceDO.java @@ -1,6 +1,7 @@ package ai.chat2db.server.domain.repository.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; @@ -18,7 +19,7 @@ */ @Getter @Setter -@TableName("DATA_SOURCE") +@TableName("data_source") public class DataSourceDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +27,7 @@ public class DataSourceDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** @@ -92,6 +93,7 @@ public class DataSourceDO implements Serializable { /** * ssl配置信息json */ + @TableField(value = "`ssl`") private String ssl; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DbhubUserDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DbhubUserDO.java index 3e0504dc2..1e0dbf752 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DbhubUserDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/DbhubUserDO.java @@ -18,7 +18,7 @@ */ @Getter @Setter -@TableName("DBHUB_USER") +@TableName("dbhub_user") public class DbhubUserDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +26,7 @@ public class DbhubUserDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/EnvironmentDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/EnvironmentDO.java index a921bc834..5b8183b47 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/EnvironmentDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/EnvironmentDO.java @@ -18,7 +18,7 @@ */ @Getter @Setter -@TableName("ENVIRONMENT") +@TableName("environment") public class EnvironmentDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +26,7 @@ public class EnvironmentDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/JdbcDriverDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/JdbcDriverDO.java index 83543da07..ca0f9bf18 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/JdbcDriverDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/JdbcDriverDO.java @@ -11,7 +11,7 @@ @Getter @Setter -@TableName("JDBC_DRIVER") +@TableName("jdbc_driver") public class JdbcDriverDO implements Serializable { private static final long serialVersionUID = 1L; @@ -19,7 +19,7 @@ public class JdbcDriverDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/OperationLogDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/OperationLogDO.java index 719593b91..bfbaaf85f 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/OperationLogDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/OperationLogDO.java @@ -19,7 +19,7 @@ */ @Getter @Setter -@TableName("OPERATION_LOG") +@TableName("operation_log") public class OperationLogDO implements Serializable { private static final long serialVersionUID = 1L; @@ -27,7 +27,7 @@ public class OperationLogDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/OperationSavedDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/OperationSavedDO.java index 902a13f76..35f2bbc8d 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/OperationSavedDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/OperationSavedDO.java @@ -18,7 +18,7 @@ */ @Getter @Setter -@TableName("OPERATION_SAVED") +@TableName("operation_saved") public class OperationSavedDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +26,7 @@ public class OperationSavedDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/PinTableDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/PinTableDO.java index 9d764d2fa..684c5c510 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/PinTableDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/PinTableDO.java @@ -11,7 +11,7 @@ @Getter @Setter -@TableName("PIN_TABLE") +@TableName("pin_table") public class PinTableDO implements Serializable { private static final long serialVersionUID = 1L; @@ -19,7 +19,7 @@ public class PinTableDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/SystemConfigDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/SystemConfigDO.java index f861419a9..19a291aec 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/SystemConfigDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/SystemConfigDO.java @@ -16,7 +16,7 @@ */ @Getter @Setter -@TableName("SYSTEM_CONFIG") +@TableName("system_config") public class SystemConfigDO implements Serializable { private static final long serialVersionUID = 1L; @@ -24,7 +24,7 @@ public class SystemConfigDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableCacheDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableCacheDO.java index 5eace2195..c636a5aec 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableCacheDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableCacheDO.java @@ -19,7 +19,7 @@ */ @Getter @Setter -@TableName("TABLE_CACHE") +@TableName("table_cache") public class TableCacheDO implements Serializable { private static final long serialVersionUID = 1L; @@ -27,7 +27,7 @@ public class TableCacheDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableCacheVersionDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableCacheVersionDO.java index 9c3d4e0f7..624a34933 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableCacheVersionDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableCacheVersionDO.java @@ -19,7 +19,7 @@ */ @Getter @Setter -@TableName("TABLE_CACHE_VERSION") +@TableName("table_cache_version") public class TableCacheVersionDO implements Serializable { private static final long serialVersionUID = 1L; @@ -27,7 +27,7 @@ public class TableCacheVersionDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableVectorMappingDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableVectorMappingDO.java index fb020c14f..7b846c353 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableVectorMappingDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TableVectorMappingDO.java @@ -17,7 +17,7 @@ */ @Getter @Setter -@TableName("TABLE_VECTOR_MAPPING") +@TableName("table_vector_mapping") public class TableVectorMappingDO implements Serializable { private static final long serialVersionUID = 1L; @@ -25,7 +25,7 @@ public class TableVectorMappingDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TeamDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TeamDO.java index 15e04221d..6d8b37947 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TeamDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TeamDO.java @@ -18,7 +18,7 @@ */ @Getter @Setter -@TableName("TEAM") +@TableName("team") public class TeamDO implements Serializable { private static final long serialVersionUID = 1L; @@ -26,7 +26,7 @@ public class TeamDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TeamUserDO.java b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TeamUserDO.java index f9f3fbbf8..f8e93a79a 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TeamUserDO.java +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/java/ai/chat2db/server/domain/repository/entity/TeamUserDO.java @@ -19,7 +19,7 @@ */ @Getter @Setter -@TableName("TEAM_USER") +@TableName("team_user") public class TeamUserDO implements Serializable { private static final long serialVersionUID = 1L; @@ -27,7 +27,7 @@ public class TeamUserDO implements Serializable { /** * 主键 */ - @TableId(value = "ID", type = IdType.AUTO) + @TableId(value = "id", type = IdType.AUTO) private Long id; /** diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/DataSourceAccessCustomMapper.xml b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/DataSourceAccessCustomMapper.xml index 789adc39c..a21d67668 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/DataSourceAccessCustomMapper.xml +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/DataSourceAccessCustomMapper.xml @@ -3,33 +3,33 @@ select dsa.* - from DATA_SOURCE_ACCESS dsa - left join TEAM t on t.id =dsa.ACCESS_OBJECT_ID and dsa.ACCESS_OBJECT_TYPE = 'TEAM' and t.status='VALID' - left join TEAM_USER tu on tu.TEAM_ID =t.ID + from data_source_access dsa + left join team t on t.id =dsa.access_object_id and dsa.access_object_type = 'TEAM' and t.status='VALID' + left join team_user tu on tu.team_id =t.id - dsa.DATA_SOURCE_ID = #{dataSourceId} - and tu.USER_ID = #{userId} + dsa.data_source_id = #{dataSourceId} + and tu.user_id = #{userId} limit 1 diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/DataSourceCustomMapper.xml b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/DataSourceCustomMapper.xml index 3c01bac27..549b7bb0a 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/DataSourceCustomMapper.xml +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/DataSourceCustomMapper.xml @@ -4,27 +4,27 @@ select * - from TABLE_CACHE tc + from table_cache tc and tc.data_source_id = #{dataSourceId} diff --git a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/TeamUserCustomMapper.xml b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/TeamUserCustomMapper.xml index c81e38777..fdb737fbf 100644 --- a/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/TeamUserCustomMapper.xml +++ b/chat2db-server/chat2db-server-domain/chat2db-server-domain-repository/src/main/resources/mapper/TeamUserCustomMapper.xml @@ -3,29 +3,29 @@ diff --git "a/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V1_0_6__\345\210\235\345\247\213\345\214\226demo\344\277\241\346\201\257.sql" "b/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V1_0_6__\345\210\235\345\247\213\345\214\226demo\344\277\241\346\201\257.sql" index 5dcff8870..9ef6cdd39 100644 --- "a/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V1_0_6__\345\210\235\345\247\213\345\214\226demo\344\277\241\346\201\257.sql" +++ "b/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V1_0_6__\345\210\235\345\247\213\345\214\226demo\344\277\241\346\201\257.sql" @@ -1,41 +1 @@ -INSERT INTO DATA_SOURCE (GMT_CREATE, GMT_MODIFIED, ALIAS, URL, USER_NAME, PASSWORD, TYPE, USER_ID, HOST, PORT, SSH,JDBC) -VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'DEMO@db.sqlgpt.cn', 'jdbc:mysql://db.sqlgpt.cn:3306/DEMO', 'demo', 'kok39AYoOSM=', 'MYSQL', 0, 'db.sqlgpt.cn', '3306', '{"use":false}', '8.0'); - -INSERT INTO DASHBOARD (ID, GMT_CREATE, GMT_MODIFIED, NAME, DESCRIPTION, SCHEMA, DELETED, USER_ID) -VALUES (1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '学生成绩分析', '学生成绩分析', '[[1],[2],[3]]', 'N', 0); - -INSERT INTO CHART (ID, GMT_CREATE, GMT_MODIFIED, SCHEMA, DATA_SOURCE_ID, DATABASE_NAME, DDL, DELETED, USER_ID) -VALUES (1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '{"chartType":"Column","xAxis":"name","yAxis":"total_score"}', 1, 'DEMO', 'SELECT s.name, sc.chinese_score, sc.math_score, sc.english_score, sc.science_score, sc.humanities_score, -(sc.chinese_score + sc.math_score + sc.english_score + sc.science_score + sc.humanities_score) AS total_score -FROM student s -JOIN score sc ON s.id = sc.student_id', 'N', 0); - -INSERT INTO CHART (ID, GMT_CREATE, GMT_MODIFIED, SCHEMA, DATA_SOURCE_ID, DATABASE_NAME, DDL, DELETED, USER_ID) -VALUES (2, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '{"chartType":"Pie","xAxis":"grade"}', 1, 'DEMO', 'SELECT s.name, - score.chinese_score, - score.math_score, - score.english_score, - score.science_score, - score.humanities_score, - (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) AS total_score, - CASE - WHEN (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) < 630 THEN "D" - WHEN (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) >= 630 AND (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) <= 735 THEN "C" - WHEN (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) > 840 THEN "A" - ELSE "B" - END AS grade -FROM score -JOIN student s ON score.student_id = s.id', 'N', 0); - -INSERT INTO CHART (ID, GMT_CREATE, GMT_MODIFIED, SCHEMA, DATA_SOURCE_ID, DATABASE_NAME, DDL, DELETED, USER_ID) -VALUES (3, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '{"chartType":"Line","xAxis":"name","yAxis":"chinese_score"}', 1, 'DEMO', 'SELECT s.name, sc.chinese_score, sc.math_score, sc.english_score, sc.science_score, sc.humanities_score, -(sc.chinese_score + sc.math_score + sc.english_score + sc.science_score + sc.humanities_score) AS total_score -FROM student s -JOIN score sc ON s.id = sc.student_id', 'N', 0); - -INSERT INTO DASHBOARD_CHART_RELATION (GMT_CREATE, GMT_MODIFIED, DASHBOARD_ID, CHART_ID) -VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 1); -INSERT INTO DASHBOARD_CHART_RELATION (GMT_CREATE, GMT_MODIFIED, DASHBOARD_ID, CHART_ID) -VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 2); -INSERT INTO DASHBOARD_CHART_RELATION (GMT_CREATE, GMT_MODIFIED, DASHBOARD_ID, CHART_ID) -VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 3); \ No newline at end of file +INSERT INTO data_source (`gmt_create`, `gmt_modified`, `alias`, `url`, `user_name`, `password`, `type`, `user_id`, `host`, `port`, `ssh`, `jdbc`) VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'DEMO@db.sqlgpt.cn', 'jdbc:mysql://db.sqlgpt.cn:3306/DEMO', 'demo', 'kok39AYoOSM=', 'MYSQL', 0, 'db.sqlgpt.cn', '3306', '{"use":false}', '8.0'); INSERT INTO dashboard (`id`, `gmt_create`, `gmt_modified`, `name`, `description`, `schema`, `deleted`, `user_id`) VALUES (1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '学生成绩分析', '学生成绩分析', '[[1],[2],[3]]', 'N', 0); INSERT INTO chart (`id`, `gmt_create`, `gmt_modified`, `schema`, `data_source_id`, `database_name`, `ddl`, `deleted`, `user_id`) VALUES (1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '{"chartType":"Column","xAxis":"name","yAxis":"total_score"}', 1, 'DEMO', 'SELECT s.name, sc.chinese_score, sc.math_score, sc.english_score, sc.science_score, sc.humanities_score, (sc.chinese_score + sc.math_score + sc.english_score + sc.science_score + sc.humanities_score) AS total_score FROM student s JOIN score sc ON s.id = sc.student_id', 'N', 0); INSERT INTO chart (`id`, `gmt_create`, `gmt_modified`, `schema`, `data_source_id`, `database_name`, `ddl`, `deleted`, `user_id`) VALUES (2, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '{"chartType":"Pie","xAxis":"grade"}', 1, 'DEMO', 'SELECT s.name, score.chinese_score, score.math_score, score.english_score, score.science_score, score.humanities_score, (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) AS total_score, CASE WHEN (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) < 630 THEN "D" WHEN (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) >= 630 AND (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) <= 735 THEN "C" WHEN (score.chinese_score + score.math_score + score.english_score + score.science_score + score.humanities_score) > 840 THEN "A" ELSE "B" END AS grade FROM score JOIN student s ON score.student_id = s.id', 'N', 0); INSERT INTO chart (`id`, `gmt_create`, `gmt_modified`, `schema`, `data_source_id`, `database_name`, `ddl`, `deleted`, `user_id`) VALUES (3, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '{"chartType":"Line","xAxis":"name","yAxis":"chinese_score"}', 1, 'DEMO', 'SELECT s.name, sc.chinese_score, sc.math_score, sc.english_score, sc.science_score, sc.humanities_score, (sc.chinese_score + sc.math_score + sc.english_score + sc.science_score + sc.humanities_score) AS total_score FROM student s JOIN score sc ON s.id = sc.student_id', 'N', 0); INSERT INTO dashboard_chart_relation (`gmt_create`, `gmt_modified`, `dashboard_id`, `chart_id`) VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 1); INSERT INTO dashboard_chart_relation (`gmt_create`, `gmt_modified`, `dashboard_id`, `chart_id`) VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 2); INSERT INTO dashboard_chart_relation (`gmt_create`, `gmt_modified`, `dashboard_id`, `chart_id`) VALUES (CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, 3); \ No newline at end of file diff --git "a/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V2_1_0__\346\224\257\346\214\201\347\216\257\345\242\203\343\200\201\347\224\250\346\210\267\346\235\203\351\231\220.sql" "b/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V2_1_0__\346\224\257\346\214\201\347\216\257\345\242\203\343\200\201\347\224\250\346\210\267\346\235\203\351\231\220.sql" index e7b895b69..1dfc39e23 100644 --- "a/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V2_1_0__\346\224\257\346\214\201\347\216\257\345\242\203\343\200\201\347\224\250\346\210\267\346\235\203\351\231\220.sql" +++ "b/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V2_1_0__\346\224\257\346\214\201\347\216\257\345\242\203\343\200\201\347\224\250\346\210\267\346\235\203\351\231\220.sql" @@ -5,12 +5,11 @@ CREATE TABLE IF NOT EXISTS `environment` `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `create_user_id` bigint(20) unsigned NOT NULL COMMENT '创建人用户id', `modified_user_id` bigint(20) unsigned NOT NULL COMMENT '修改人用户id', - `name` varchar(128) DEFAULT NOT NULL COMMENT '环境名称', + `name` varchar(128) NOT NULL COMMENT '环境名称', `short_name` varchar(128) DEFAULT NULL COMMENT '环境缩写', `color` varchar(32) DEFAULT NULL COMMENT '颜色', PRIMARY KEY (`id`) -) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4 COMMENT ='数据库连接环境' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT ='数据库连接环境' ; INSERT INTO `environment` @@ -30,7 +29,7 @@ ALTER TABLE `data_source` ADD COLUMN `kind` varchar(32) NOT NULL DEFAULT 'PRIVATE' COMMENT '连接类型'; update data_source -set user_id= 1; +set `user_id`= 1; ALTER TABLE `dbhub_user` ADD COLUMN `role_code` varchar(32) DEFAULT NULL COMMENT '角色编码'; @@ -45,11 +44,11 @@ ALTER TABLE `dbhub_user` ADD `modified_user_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '修改人用户id'; update dbhub_user -set role_code= 'DESKTOP',user_name='_desktop_default_user_name',password='_desktop_default_user_name',nick_name='Desktop User' -where id = 1; -INSERT INTO DBHUB_USER (USER_NAME, PASSWORD, NICK_NAME, EMAIL, ROLE_CODE) VALUES ('chat2db', 'chat2db', 'Administrator', null, 'ADMIN'); +set `role_code`= 'DESKTOP',`user_name`='_desktop_default_user_name',`password`='_desktop_default_user_name',`nick_name`='Desktop User' +where `id` = 1; +INSERT INTO dbhub_user (`user_name`, `password`, `nick_name`, `email`, `role_code`) VALUES ('chat2db', 'chat2db', 'Administrator', null, 'ADMIN'); -create UNIQUE INDEX uk_user_user_name on dbhub_user (user_name); +create UNIQUE INDEX uk_user_user_name on dbhub_user (`user_name`); CREATE TABLE IF NOT EXISTS `team` @@ -59,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `team` `gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', `create_user_id` bigint(20) unsigned NOT NULL COMMENT '创建人用户id', `modified_user_id` bigint(20) unsigned NOT NULL COMMENT '修改人用户id', - `code` varchar(128) DEFAULT NOT NULL COMMENT '团队编码', + `code` varchar(128) NOT NULL COMMENT '团队编码', `name` varchar(512) DEFAULT NULL COMMENT '团队名称', `status` varchar(32) NOT NULL DEFAULT 'VALID' COMMENT '团队状态', `description` text DEFAULT NULL COMMENT '团队描述', @@ -68,7 +67,7 @@ CREATE TABLE IF NOT EXISTS `team` DEFAULT CHARSET = utf8mb4 COMMENT ='团队' ; -create UNIQUE INDEX uk_team_code on team (code); +create UNIQUE INDEX uk_team_code on team (`code`); CREATE TABLE IF NOT EXISTS `team_user` @@ -112,22 +111,22 @@ ALTER TABLE `operation_saved` modify COLUMN `user_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '用户id'; update operation_saved -set user_id= 1; +set `user_id`= 1; ALTER TABLE `operation_log` modify COLUMN `user_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '用户id'; update operation_log -set user_id= 1; +set `user_id`= 1; ALTER TABLE `dashboard` modify `user_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '用户id'; update dashboard -set user_id= 1; +set `user_id`= 1; ALTER TABLE `chart` modify `user_id` bigint(20) unsigned NOT NULL DEFAULT 1 COMMENT '用户id'; update chart -set user_id= 1; +set `user_id`= 1; diff --git a/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V2_1_6__TableVectorUpdate.sql b/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V2_1_6__TableVectorUpdate.sql index 196581ad9..4a67420f9 100644 --- a/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V2_1_6__TableVectorUpdate.sql +++ b/chat2db-server/chat2db-server-start/src/main/resources/db/migration/V2_1_6__TableVectorUpdate.sql @@ -1 +1,5 @@ -ALTER TABLE table_vector_mapping ALTER COLUMN status VARCHAR(64); +ALTER TABLE table_vector_mapping MODIFY COLUMN status VARCHAR(64); + +ALTER TABLE operation_saved ALTER COLUMN data_source_id SET DEFAULT 0; + +ALTER TABLE operation_saved ALTER COLUMN type SET default ''; \ No newline at end of file