适配OpenGauss数据库

This commit is contained in:
inrgihc
2024-10-17 22:02:39 +08:00
parent 30a96a0b42
commit f3a51c2097
351 changed files with 38119 additions and 38 deletions

View File

@@ -30,6 +30,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.gitee.dbswitch</groupId>
<artifactId>flyway-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
@@ -65,11 +71,6 @@
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>

View File

@@ -38,7 +38,7 @@ public class AssignmentDetailConverter extends
config.setSourceConnectionName(srcConn.getName());
config.setSourceSchema(taskConfig.getSourceSchema());
config.setTableType(taskConfig.getTableType());
config.setIncludeOrExclude(taskConfig.getExcluded()
config.setIncludeOrExclude(taskConfig.getExcludedFlag()
? IncludeExcludeEnum.EXCLUDE
: IncludeExcludeEnum.INCLUDE);
config.setSourceTables(taskConfig.getSourceTables());

View File

@@ -53,8 +53,8 @@ public class AssignmentConfigEntity {
@TableField(value = "source_tables", typeHandler = ListTypeHandler.class)
private List<String> sourceTables;
@TableField("excluded")
private Boolean excluded;
@TableField("excluded_flag")
private Boolean excludedFlag;
@TableField("target_connection_id")
private Long targetConnectionId;

View File

@@ -54,7 +54,7 @@ public class AssigmentBaseRequest {
assignmentConfigEntity.setSourceSchema(config.getSourceSchema());
assignmentConfigEntity.setTableType(config.getTableType());
assignmentConfigEntity.setSourceTables(config.getSourceTables());
assignmentConfigEntity.setExcluded(
assignmentConfigEntity.setExcludedFlag(
config.getIncludeOrExclude() == IncludeExcludeEnum.EXCLUDE
);
assignmentConfigEntity.setTargetConnectionId(config.getTargetConnectionId());

View File

@@ -54,7 +54,7 @@ public class AssigmentCreateRequest extends AssigmentBaseRequest {
AssignmentConfigEntity assignmentConfigEntity = toAssignmentConfig(assignmentId, config);
assignmentConfigEntity.setFirstFlag(Boolean.TRUE);
if (!assignmentConfigEntity.getExcluded()
if (!assignmentConfigEntity.getExcludedFlag()
&& !CollectionUtils.isEmpty(assignmentConfigEntity.getSourceTables())) {
for (String tableName : assignmentConfigEntity.getSourceTables()) {
String targetTableName = PatterNameUtils.getFinalName(tableName,

View File

@@ -272,7 +272,7 @@ public class AssignmentService {
sourceDataSourceProperties.setPassword(sourceDatabaseConnectionEntity.getPassword());
String sourceSchema = assignmentConfigEntity.getSourceSchema();
if (assignmentConfigEntity.getExcluded()) {
if (assignmentConfigEntity.getExcludedFlag()) {
if (CollectionUtils.isEmpty(assignmentConfigEntity.getSourceTables())) {
sourceDataSourceProperties.setSourceExcludes("");
} else {

View File

@@ -0,0 +1,2 @@
ALTER TABLE `DBSWITCH_ASSIGNMENT_CONFIG`
CHANGE COLUMN `excluded` `excluded_flag` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否排除(0:否 1:是)' AFTER `source_tables`;

View File

@@ -123,7 +123,7 @@ CREATE TABLE IF NOT EXISTS DBSWITCH_ASSIGNMENT_CONFIG (
"source_schema" varchar(1024) not null,
"table_type" varchar(32) not null default 'TABLE',
"source_tables" text ,
"excluded" boolean not null default false,
"excluded_flag" boolean not null default false,
"target_connection_id" int8 not null,
"table_name_case" varchar(32) not null default 'NONE',
"column_name_case" varchar(32) not null default 'NONE',
@@ -153,7 +153,7 @@ COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."source_connection_id" IS '来源
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."source_schema" IS '来源端的schema';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."table_type" IS '表类型:TABLE;VIEW';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."source_tables" IS '来源端的table列表';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."excluded" IS '是否排除(0:否 1:是)';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."excluded_flag" IS '是否排除(0:否 1:是)';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."target_connection_id" IS '目的端连接ID';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."target_schema" IS '目的端的schema(一个)';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."table_name_case" IS '表名大小写转换策略';
@@ -185,7 +185,6 @@ CREATE TABLE IF NOT EXISTS DBSWITCH_ASSIGNMENT_JOB (
primary key ("id"),
foreign key ("assignment_id") references DBSWITCH_ASSIGNMENT_TASK ("id") on delete cascade on update cascade
);
COMMENT ON TABLE DBSWITCH_ASSIGNMENT_JOB IS 'JOB日志表';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_JOB."id" IS '主键';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_JOB."assignment_id" IS '任务ID';
@@ -197,3 +196,17 @@ COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_JOB."status" IS '执行状态:0-未执行;
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_JOB."error_log" IS '异常日志';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_JOB."create_time" IS '创建时间';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_JOB."update_time" IS '修改时间';
CREATE TABLE IF NOT EXISTS DBSWITCH_JOB_LOGBACK (
"id" bigserial not null,
"uuid" varchar(128) not null default '',
"content" text,
"create_time" timestamp(6) not null default (CURRENT_TIMESTAMP(0))::timestamp(0) without time zone,
PRIMARY KEY ("id")
);
CREATE INDEX DBSWITCH_JOB_LOGBACK_UUID_IDX ON DBSWITCH_JOB_LOGBACK("uuid");
COMMENT ON TABLE DBSWITCH_JOB_LOGBACK IS 'JOB执行日志';
COMMENT ON COLUMN DBSWITCH_JOB_LOGBACK."id" IS '主键';
COMMENT ON COLUMN DBSWITCH_JOB_LOGBACK."uuid" IS 'job id';
COMMENT ON COLUMN DBSWITCH_JOB_LOGBACK."content" IS '日志内容';
COMMENT ON COLUMN DBSWITCH_JOB_LOGBACK."create_time" IS '创建时间';

View File

@@ -1,14 +0,0 @@
CREATE TABLE IF NOT EXISTS DBSWITCH_JOB_LOGBACK (
"id" bigserial not null,
"uuid" varchar(128) not null default '',
"content" text,
"create_time" timestamp(6) not null default (CURRENT_TIMESTAMP(0))::timestamp(0) without time zone,
PRIMARY KEY ("id")
);
CREATE INDEX DBSWITCH_JOB_LOGBACK_UUID_IDX ON DBSWITCH_JOB_LOGBACK("uuid");
COMMENT ON TABLE DBSWITCH_JOB_LOGBACK IS 'JOB执行日志';
COMMENT ON COLUMN DBSWITCH_JOB_LOGBACK."id" IS '主键';
COMMENT ON COLUMN DBSWITCH_JOB_LOGBACK."uuid" IS 'job id';
COMMENT ON COLUMN DBSWITCH_JOB_LOGBACK."content" IS '日志内容';
COMMENT ON COLUMN DBSWITCH_JOB_LOGBACK."create_time" IS '创建时间';