支持名称大小写转换

This commit is contained in:
inrgihc
2023-08-08 21:27:10 +08:00
parent 24ba0e10d1
commit 7e8a8d9dba
36 changed files with 421 additions and 98 deletions

View File

@@ -185,6 +185,10 @@ dbswitch:
# target database configuration parameters # target database configuration parameters
## schema name for create/insert table data ## schema name for create/insert table data
target-schema: public target-schema: public
## table name to uppper case, option: UPPER,LOWER,NONE
table-name-case: UPPER
## column name to uppper case, option: UPPER,LOWER,NONE
column-name-case: UPPER
## whether drop-create table when target table exist ## whether drop-create table when target table exist
target-drop: true target-drop: true
## whether create table support auto increment for primary key field ## whether create table support auto increment for primary key field
@@ -216,6 +220,8 @@ dbswitch:
| dbswitch.target.username | 目的端连接帐号名 | test | 无 | | dbswitch.target.username | 目的端连接帐号名 | test | 无 |
| dbswitch.target.password | 目的端连接帐号密码 | 123456 | 无 | | dbswitch.target.password | 目的端连接帐号密码 | 123456 | 无 |
| dbswitch.target.target-schema | 目的端的schema名称 | public | 目的端的schema名称只能有且只有一个 | | dbswitch.target.target-schema | 目的端的schema名称 | public | 目的端的schema名称只能有且只有一个 |
| dbswitch.target.table-name-case | 表名大小写转换策略 | UPPER | 可选值为: UPPER,LOWER,NONE |
| dbswitch.target.column-name-case | 列名大小写转换策略 | UPPER | 可选值为: UPPER,LOWER,NONE |
| dbswitch.target.target-drop | 是否执行先drop表然后create表命令,当target.datasource-target.drop=true时有效 | true | 可选值为true、false | | dbswitch.target.target-drop | 是否执行先drop表然后create表命令,当target.datasource-target.drop=true时有效 | true | 可选值为true、false |
| dbswitch.target.create-table-auto-increment | 是否执启用支持create表时主键自增 | true | 可选值为true、false | | dbswitch.target.create-table-auto-increment | 是否执启用支持create表时主键自增 | true | 可选值为true、false |
| dbswitch.target.writer-engine-insert | 是否使用insert写入数据 | false | 可选值为true为insert写入、false为copy写入只针对目的端数据库为PostgreSQL/Greenplum的有效 | | dbswitch.target.writer-engine-insert | 是否使用insert写入数据 | false | 可选值为true为insert写入、false为copy写入只针对目的端数据库为PostgreSQL/Greenplum的有效 |

View File

@@ -208,6 +208,44 @@
:value=20000></el-option> :value=20000></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="表名大小写转换"
label-width="240px"
prop="tableNameCase"
style="width:45%">
<el-tooltip placement="top">
<div slot="content">
表名大小写转换说明:先使用下面的表名映射,然后再使用这里的大小写转换,对支持大小写敏感的数据库类型有效。
</div>
<i class="el-icon-question"></i>
</el-tooltip>
<el-select v-model="createform.tableNameCase">
<el-option label='无转换'
value='NONE'></el-option>
<el-option label='转大写'
value='UPPER'></el-option>
<el-option label='转小写'
value='LOWER'></el-option>
</el-select>
</el-form-item>
<el-form-item label="列名大小写转换"
label-width="240px"
prop="columnNameCase"
style="width:45%">
<el-tooltip placement="top">
<div slot="content">
列名大小写转换说明:先使用下面的列名映射,然后再使用这里的大小写转换,对支持大小写敏感的数据库类型有效。
</div>
<i class="el-icon-question"></i>
</el-tooltip>
<el-select v-model="createform.columnNameCase">
<el-option label='无转换'
value='NONE'></el-option>
<el-option label='转大写'
value='UPPER'></el-option>
<el-option label='转小写'
value='LOWER'></el-option>
</el-select>
</el-form-item>
</div> </div>
<div v-show="active == 4"> <div v-show="active == 4">
<div class="tip-content"> <div class="tip-content">
@@ -329,6 +367,28 @@
<el-descriptions-item label="目地端schema">{{createform.targetSchema}}</el-descriptions-item> <el-descriptions-item label="目地端schema">{{createform.targetSchema}}</el-descriptions-item>
<el-descriptions-item label="只创建表">{{createform.targetOnlyCreate}}</el-descriptions-item> <el-descriptions-item label="只创建表">{{createform.targetOnlyCreate}}</el-descriptions-item>
<el-descriptions-item label="数据处理批次量">{{createform.batchSize}}</el-descriptions-item> <el-descriptions-item label="数据处理批次量">{{createform.batchSize}}</el-descriptions-item>
<el-descriptions-item label="表名大小写转换">
<span v-if="createform.tableNameCase == 'NONE'">
无转换
</span>
<span v-if="createform.tableNameCase == 'UPPER'">
转大写
</span>
<span v-if="createform.tableNameCase == 'LOWER'">
转小写
</span>
</el-descriptions-item>
<el-descriptions-item label="列名大小写转换">
<span v-if="createform.columnNameCase == 'NONE'">
无转换
</span>
<span v-if="createform.columnNameCase == 'UPPER'">
转大写
</span>
<span v-if="createform.columnNameCase == 'LOWER'">
转小写
</span>
</el-descriptions-item>
<el-descriptions-item label="表名映射规则"> <el-descriptions-item label="表名映射规则">
<span v-show="createform.tableNameMapper.length==0">[映射关系为空]</span> <span v-show="createform.tableNameMapper.length==0">[映射关系为空]</span>
<table v-if="createform.tableNameMapper.length>0" <table v-if="createform.tableNameMapper.length>0"
@@ -454,6 +514,8 @@ export default {
sourceTables: [], sourceTables: [],
tableNameMapper: [], tableNameMapper: [],
columnNameMapper: [], columnNameMapper: [],
tableNameCase: 'NONE',
columnNameCase: 'NONE',
targetConnectionId: '请选择', targetConnectionId: '请选择',
targetDropTable: true, targetDropTable: true,
targetOnlyCreate: false, targetOnlyCreate: false,
@@ -701,6 +763,7 @@ export default {
isInclude: this.createform.includeOrExclude == 'INCLUDE', isInclude: this.createform.includeOrExclude == 'INCLUDE',
tableNames: this.createform.sourceTables, tableNames: this.createform.sourceTables,
nameMapper: this.createform.tableNameMapper, nameMapper: this.createform.tableNameMapper,
tableNameCase: this.createform.tableNameCase
}) })
}).then(res => { }).then(res => {
if (0 === res.data.code) { if (0 === res.data.code) {
@@ -786,6 +849,7 @@ export default {
isInclude: this.createform.includeOrExclude == 'INCLUDE', isInclude: this.createform.includeOrExclude == 'INCLUDE',
tableName: this.preiveTableName, tableName: this.preiveTableName,
nameMapper: this.createform.columnNameMapper, nameMapper: this.createform.columnNameMapper,
columnNameCase: this.createform.columnNameCase
}) })
}).then(res => { }).then(res => {
if (0 === res.data.code) { if (0 === res.data.code) {
@@ -822,6 +886,8 @@ export default {
targetSchema: this.createform.targetSchema, targetSchema: this.createform.targetSchema,
tableNameMapper: this.createform.tableNameMapper, tableNameMapper: this.createform.tableNameMapper,
columnNameMapper: this.createform.columnNameMapper, columnNameMapper: this.createform.columnNameMapper,
tableNameCase: this.createform.tableNameCase,
columnNameCase: this.createform.columnNameCase,
targetDropTable: true, targetDropTable: true,
targetOnlyCreate: this.createform.targetOnlyCreate, targetOnlyCreate: this.createform.targetOnlyCreate,
batchSize: this.createform.batchSize batchSize: this.createform.batchSize

View File

@@ -208,6 +208,44 @@
:value=20000></el-option> :value=20000></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="表名大小写转换"
label-width="240px"
prop="tableNameCase"
style="width:45%">
<el-tooltip placement="top">
<div slot="content">
表名大小写转换说明:先使用下面的表名映射,然后再使用这里的大小写转换,对支持大小写敏感的数据库类型有效。
</div>
<i class="el-icon-question"></i>
</el-tooltip>
<el-select v-model="updateform.tableNameCase">
<el-option label='无转换'
value='NONE'></el-option>
<el-option label='转大写'
value='UPPER'></el-option>
<el-option label='转小写'
value='LOWER'></el-option>
</el-select>
</el-form-item>
<el-form-item label="列名大小写转换"
label-width="240px"
prop="columnNameCase"
style="width:45%">
<el-tooltip placement="top">
<div slot="content">
列名大小写转换说明:先使用下面的列名映射,然后再使用这里的大小写转换,对支持大小写敏感的数据库类型有效。
</div>
<i class="el-icon-question"></i>
</el-tooltip>
<el-select v-model="updateform.columnNameCase">
<el-option label='无转换'
value='NONE'></el-option>
<el-option label='转大写'
value='UPPER'></el-option>
<el-option label='转小写'
value='LOWER'></el-option>
</el-select>
</el-form-item>
</div> </div>
<div v-show="active == 4"> <div v-show="active == 4">
<div class="tip-content"> <div class="tip-content">
@@ -329,6 +367,28 @@
<el-descriptions-item label="目地端schema">{{updateform.targetSchema}}</el-descriptions-item> <el-descriptions-item label="目地端schema">{{updateform.targetSchema}}</el-descriptions-item>
<el-descriptions-item label="只创建表">{{updateform.targetOnlyCreate}}</el-descriptions-item> <el-descriptions-item label="只创建表">{{updateform.targetOnlyCreate}}</el-descriptions-item>
<el-descriptions-item label="数据处理批次量">{{updateform.batchSize}}</el-descriptions-item> <el-descriptions-item label="数据处理批次量">{{updateform.batchSize}}</el-descriptions-item>
<el-descriptions-item label="表名大小写转换">
<span v-if="updateform.tableNameCase == 'NONE'">
无转换
</span>
<span v-if="updateform.tableNameCase == 'UPPER'">
转大写
</span>
<span v-if="updateform.tableNameCase == 'LOWER'">
转小写
</span>
</el-descriptions-item>
<el-descriptions-item label="列名大小写转换">
<span v-if="updateform.columnNameCase == 'NONE'">
无转换
</span>
<span v-if="updateform.columnNameCase == 'UPPER'">
转大写
</span>
<span v-if="updateform.columnNameCase == 'LOWER'">
转小写
</span>
</el-descriptions-item>
<el-descriptions-item label="表名映射规则"> <el-descriptions-item label="表名映射规则">
<span v-show="!updateform.tableNameMapper || updateform.tableNameMapper.length==0">[映射关系为空]</span> <span v-show="!updateform.tableNameMapper || updateform.tableNameMapper.length==0">[映射关系为空]</span>
<table v-if="updateform.tableNameMapper && updateform.tableNameMapper.length>0" <table v-if="updateform.tableNameMapper && updateform.tableNameMapper.length>0"
@@ -455,11 +515,13 @@ export default {
cronExpression: "", cronExpression: "",
sourceConnectionId: '请选择', sourceConnectionId: '请选择',
sourceSchema: "", sourceSchema: "",
tableType:"TABLE", tableType: "TABLE",
includeOrExclude: "", includeOrExclude: "",
sourceTables: [], sourceTables: [],
tableNameMapper: [], tableNameMapper: [],
columnNameMapper: [], columnNameMapper: [],
tableNameCase: 'NONE',
columnNameCase: 'NONE',
targetConnectionId: '请选择', targetConnectionId: '请选择',
targetDropTable: true, targetDropTable: true,
targetOnlyCreate: false, targetOnlyCreate: false,
@@ -618,6 +680,8 @@ export default {
sourceTables: detail.configuration.sourceTables, sourceTables: detail.configuration.sourceTables,
tableNameMapper: detail.configuration.tableNameMapper, tableNameMapper: detail.configuration.tableNameMapper,
columnNameMapper: detail.configuration.columnNameMapper, columnNameMapper: detail.configuration.columnNameMapper,
tableNameCase: detail.configuration.tableNameCase,
columnNameCase: detail.configuration.columnNameCase,
targetConnectionId: detail.configuration.targetConnectionId, targetConnectionId: detail.configuration.targetConnectionId,
targetDropTable: detail.configuration.targetDropTable, targetDropTable: detail.configuration.targetDropTable,
targetOnlyCreate: detail.configuration.targetOnlyCreate, targetOnlyCreate: detail.configuration.targetOnlyCreate,
@@ -754,6 +818,7 @@ export default {
isInclude: this.updateform.includeOrExclude == 'INCLUDE', isInclude: this.updateform.includeOrExclude == 'INCLUDE',
tableNames: this.updateform.sourceTables, tableNames: this.updateform.sourceTables,
nameMapper: this.updateform.tableNameMapper, nameMapper: this.updateform.tableNameMapper,
tableNameCase: this.updateform.tableNameCase
}) })
}).then(res => { }).then(res => {
if (0 === res.data.code) { if (0 === res.data.code) {
@@ -843,6 +908,7 @@ export default {
isInclude: this.updateform.includeOrExclude == 'INCLUDE', isInclude: this.updateform.includeOrExclude == 'INCLUDE',
tableName: this.preiveTableName, tableName: this.preiveTableName,
nameMapper: this.updateform.columnNameMapper, nameMapper: this.updateform.columnNameMapper,
columnNameCase: this.updateform.columnNameCase
}) })
}).then(res => { }).then(res => {
if (0 === res.data.code) { if (0 === res.data.code) {
@@ -880,6 +946,8 @@ export default {
targetSchema: this.updateform.targetSchema, targetSchema: this.updateform.targetSchema,
tableNameMapper: this.updateform.tableNameMapper, tableNameMapper: this.updateform.tableNameMapper,
columnNameMapper: this.updateform.columnNameMapper, columnNameMapper: this.updateform.columnNameMapper,
tableNameCase: this.updateform.tableNameCase,
columnNameCase: this.updateform.columnNameCase,
targetDropTable: true, targetDropTable: true,
targetOnlyCreate: this.updateform.targetOnlyCreate, targetOnlyCreate: this.updateform.targetOnlyCreate,
batchSize: this.updateform.batchSize batchSize: this.updateform.batchSize

View File

@@ -51,6 +51,8 @@ public class AssignmentDetailConverter extends
config.setTargetConnectionName(dstConn.getName()); config.setTargetConnectionName(dstConn.getName());
config.setTargetSchema(taskConfig.getTargetSchema()); config.setTargetSchema(taskConfig.getTargetSchema());
config.setTargetOnlyCreate(taskConfig.getTargetOnlyCreate()); config.setTargetOnlyCreate(taskConfig.getTargetOnlyCreate());
config.setTableNameCase(taskConfig.getTableNameCase());
config.setColumnNameCase(taskConfig.getColumnNameCase());
config.setTableNameMapper(taskConfig.getTableNameMap()); config.setTableNameMapper(taskConfig.getTableNameMap());
config.setColumnNameMapper(taskConfig.getColumnNameMap()); config.setColumnNameMapper(taskConfig.getColumnNameMap());
config.setBatchSize(taskConfig.getBatchSize()); config.setBatchSize(taskConfig.getBatchSize());

View File

@@ -12,6 +12,7 @@ package com.gitee.dbswitch.admin.entity;
import com.gitee.dbswitch.admin.handler.ListPatternHandler; import com.gitee.dbswitch.admin.handler.ListPatternHandler;
import com.gitee.dbswitch.admin.handler.ListTypeHandler; import com.gitee.dbswitch.admin.handler.ListTypeHandler;
import com.gitee.dbswitch.common.entity.PatternMapper; import com.gitee.dbswitch.common.entity.PatternMapper;
import com.gitee.dbswitch.common.type.CaseConvertEnum;
import com.gitee.dbswitch.common.type.ProductTableEnum; import com.gitee.dbswitch.common.type.ProductTableEnum;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List; import java.util.List;
@@ -60,6 +61,12 @@ public class AssignmentConfigEntity {
@Column(name = "target_schema") @Column(name = "target_schema")
private String targetSchema; private String targetSchema;
@Column(name = "table_name_case")
private CaseConvertEnum tableNameCase;
@Column(name = "column_name_case")
private CaseConvertEnum columnNameCase;
@Column(name = "table_name_map") @Column(name = "table_name_map")
@ColumnType(typeHandler = ListPatternHandler.class) @ColumnType(typeHandler = ListPatternHandler.class)
private List<PatternMapper> tableNameMap; private List<PatternMapper> tableNameMap;

View File

@@ -17,6 +17,7 @@ import com.gitee.dbswitch.admin.type.IncludeExcludeEnum;
import com.gitee.dbswitch.admin.type.ScheduleModeEnum; import com.gitee.dbswitch.admin.type.ScheduleModeEnum;
import com.gitee.dbswitch.admin.util.CronExprUtils; import com.gitee.dbswitch.admin.util.CronExprUtils;
import com.gitee.dbswitch.common.entity.PatternMapper; import com.gitee.dbswitch.common.entity.PatternMapper;
import com.gitee.dbswitch.common.type.CaseConvertEnum;
import com.gitee.dbswitch.common.type.ProductTableEnum; import com.gitee.dbswitch.common.type.ProductTableEnum;
import com.gitee.dbswitch.common.util.PatterNameUtils; import com.gitee.dbswitch.common.util.PatterNameUtils;
import java.util.List; import java.util.List;
@@ -47,6 +48,8 @@ public class AssigmentCreateRequest {
private List<String> sourceTables; private List<String> sourceTables;
private Long targetConnectionId; private Long targetConnectionId;
private String targetSchema; private String targetSchema;
private CaseConvertEnum tableNameCase;
private CaseConvertEnum columnNameCase;
private List<PatternMapper> tableNameMapper; private List<PatternMapper> tableNameMapper;
private List<PatternMapper> columnNameMapper; private List<PatternMapper> columnNameMapper;
private Boolean targetDropTable; private Boolean targetDropTable;
@@ -84,6 +87,8 @@ public class AssigmentCreateRequest {
); );
assignmentConfigEntity.setTargetConnectionId(this.getConfig().getTargetConnectionId()); assignmentConfigEntity.setTargetConnectionId(this.getConfig().getTargetConnectionId());
assignmentConfigEntity.setTargetSchema(this.getConfig().getTargetSchema()); assignmentConfigEntity.setTargetSchema(this.getConfig().getTargetSchema());
assignmentConfigEntity.setTableNameCase(this.getConfig().getTableNameCase());
assignmentConfigEntity.setColumnNameCase(this.getConfig().getColumnNameCase());
assignmentConfigEntity.setTableNameMap(this.getConfig().getTableNameMapper()); assignmentConfigEntity.setTableNameMap(this.getConfig().getTableNameMapper());
assignmentConfigEntity.setColumnNameMap(this.getConfig().getColumnNameMapper()); assignmentConfigEntity.setColumnNameMap(this.getConfig().getColumnNameMapper());
assignmentConfigEntity.setTargetDropTable(this.getConfig().getTargetDropTable()); assignmentConfigEntity.setTargetDropTable(this.getConfig().getTargetDropTable());

View File

@@ -17,6 +17,7 @@ import com.gitee.dbswitch.admin.type.IncludeExcludeEnum;
import com.gitee.dbswitch.admin.type.ScheduleModeEnum; import com.gitee.dbswitch.admin.type.ScheduleModeEnum;
import com.gitee.dbswitch.admin.util.CronExprUtils; import com.gitee.dbswitch.admin.util.CronExprUtils;
import com.gitee.dbswitch.common.entity.PatternMapper; import com.gitee.dbswitch.common.entity.PatternMapper;
import com.gitee.dbswitch.common.type.CaseConvertEnum;
import com.gitee.dbswitch.common.type.ProductTableEnum; import com.gitee.dbswitch.common.type.ProductTableEnum;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
@@ -45,6 +46,8 @@ public class AssigmentUpdateRequest {
private List<String> sourceTables; private List<String> sourceTables;
private Long targetConnectionId; private Long targetConnectionId;
private String targetSchema; private String targetSchema;
private CaseConvertEnum tableNameCase;
private CaseConvertEnum columnNameCase;
private List<PatternMapper> tableNameMapper; private List<PatternMapper> tableNameMapper;
private List<PatternMapper> columnNameMapper; private List<PatternMapper> columnNameMapper;
private Boolean targetDropTable; private Boolean targetDropTable;
@@ -82,6 +85,8 @@ public class AssigmentUpdateRequest {
); );
assignmentConfigEntity.setTargetConnectionId(this.getConfig().getTargetConnectionId()); assignmentConfigEntity.setTargetConnectionId(this.getConfig().getTargetConnectionId());
assignmentConfigEntity.setTargetSchema(this.getConfig().getTargetSchema()); assignmentConfigEntity.setTargetSchema(this.getConfig().getTargetSchema());
assignmentConfigEntity.setTableNameCase(this.getConfig().getTableNameCase());
assignmentConfigEntity.setColumnNameCase(this.getConfig().getColumnNameCase());
assignmentConfigEntity.setTableNameMap(this.getConfig().getTableNameMapper()); assignmentConfigEntity.setTableNameMap(this.getConfig().getTableNameMapper());
assignmentConfigEntity.setColumnNameMap(this.getConfig().getColumnNameMapper()); assignmentConfigEntity.setColumnNameMap(this.getConfig().getColumnNameMapper());
assignmentConfigEntity.setTargetDropTable(this.getConfig().getTargetDropTable()); assignmentConfigEntity.setTargetDropTable(this.getConfig().getTargetDropTable());

View File

@@ -1,6 +1,7 @@
package com.gitee.dbswitch.admin.model.request; package com.gitee.dbswitch.admin.model.request;
import com.gitee.dbswitch.common.entity.PatternMapper; import com.gitee.dbswitch.common.entity.PatternMapper;
import com.gitee.dbswitch.common.type.CaseConvertEnum;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -13,4 +14,5 @@ public class PreviewColumnNameMapperRequest {
private String schemaName; private String schemaName;
private String tableName; private String tableName;
private List<PatternMapper> nameMapper; private List<PatternMapper> nameMapper;
private CaseConvertEnum columnNameCase;
} }

View File

@@ -1,6 +1,7 @@
package com.gitee.dbswitch.admin.model.request; package com.gitee.dbswitch.admin.model.request;
import com.gitee.dbswitch.common.entity.PatternMapper; import com.gitee.dbswitch.common.entity.PatternMapper;
import com.gitee.dbswitch.common.type.CaseConvertEnum;
import java.util.List; import java.util.List;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@@ -14,4 +15,5 @@ public class PreviewTableNameMapperRequest {
private Boolean isInclude; private Boolean isInclude;
private List<String> tableNames; private List<String> tableNames;
private List<PatternMapper> nameMapper; private List<PatternMapper> nameMapper;
private CaseConvertEnum tableNameCase;
} }

View File

@@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.gitee.dbswitch.admin.type.IncludeExcludeEnum; import com.gitee.dbswitch.admin.type.IncludeExcludeEnum;
import com.gitee.dbswitch.admin.type.ScheduleModeEnum; import com.gitee.dbswitch.admin.type.ScheduleModeEnum;
import com.gitee.dbswitch.common.entity.PatternMapper; import com.gitee.dbswitch.common.entity.PatternMapper;
import com.gitee.dbswitch.common.type.CaseConvertEnum;
import com.gitee.dbswitch.common.type.ProductTableEnum; import com.gitee.dbswitch.common.type.ProductTableEnum;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@@ -90,6 +91,12 @@ public class AssignmentDetailResponse {
@ApiModelProperty("是否只建表") @ApiModelProperty("是否只建表")
private Boolean targetOnlyCreate; private Boolean targetOnlyCreate;
@ApiModelProperty("表名大小写配置")
private CaseConvertEnum tableNameCase;
@ApiModelProperty("列名大小写配置")
private CaseConvertEnum columnNameCase;
@ApiModelProperty("表名映射关系") @ApiModelProperty("表名映射关系")
private List<PatternMapper> tableNameMapper; private List<PatternMapper> tableNameMapper;

View File

@@ -274,6 +274,8 @@ public class AssignmentService {
if (assignmentConfigEntity.getTargetOnlyCreate()) { if (assignmentConfigEntity.getTargetOnlyCreate()) {
targetDataSourceProperties.setOnlyCreate(Boolean.TRUE); targetDataSourceProperties.setOnlyCreate(Boolean.TRUE);
} }
targetDataSourceProperties.setTableNameCase(assignmentConfigEntity.getTableNameCase());
targetDataSourceProperties.setColumnNameCase(assignmentConfigEntity.getColumnNameCase());
return targetDataSourceProperties; return targetDataSourceProperties;
} }

View File

@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
package com.gitee.dbswitch.admin.service; package com.gitee.dbswitch.admin.service;
import com.gitee.dbswitch.common.converter.ConverterFactory; import cn.hutool.core.io.FileUtil;
import com.gitee.dbswitch.admin.common.exception.DbswitchException; import com.gitee.dbswitch.admin.common.exception.DbswitchException;
import com.gitee.dbswitch.admin.common.response.PageResult; import com.gitee.dbswitch.admin.common.response.PageResult;
import com.gitee.dbswitch.admin.common.response.Result; import com.gitee.dbswitch.admin.common.response.Result;
@@ -25,6 +25,7 @@ import com.gitee.dbswitch.admin.model.response.DatabaseTypeDriverResponse;
import com.gitee.dbswitch.admin.model.response.DbConnectionDetailResponse; import com.gitee.dbswitch.admin.model.response.DbConnectionDetailResponse;
import com.gitee.dbswitch.admin.model.response.DbConnectionNameResponse; import com.gitee.dbswitch.admin.model.response.DbConnectionNameResponse;
import com.gitee.dbswitch.admin.util.PageUtils; import com.gitee.dbswitch.admin.util.PageUtils;
import com.gitee.dbswitch.common.converter.ConverterFactory;
import com.gitee.dbswitch.common.entity.CloseableDataSource; import com.gitee.dbswitch.common.entity.CloseableDataSource;
import com.gitee.dbswitch.common.type.ProductTypeEnum; import com.gitee.dbswitch.common.type.ProductTypeEnum;
import com.gitee.dbswitch.common.util.JdbcUrlUtils; import com.gitee.dbswitch.common.util.JdbcUrlUtils;
@@ -110,9 +111,7 @@ public class ConnectionService {
.driverClass(dbTypeEnum.getDriver()) .driverClass(dbTypeEnum.getDriver())
.driverPath(v.getAbsolutePath()) .driverPath(v.getAbsolutePath())
.jarFiles( .jarFiles(
DataSourceUtils.findJarFilesFromDirectory(v.getAbsolutePath()) FileUtil.listFileNames(v.getAbsolutePath())
.stream().map(f -> f.toFile().getName())
.collect(Collectors.toList())
) )
.build() .build()
) )

View File

@@ -68,6 +68,9 @@ public class PatternMapperService {
} }
} }
} }
result.forEach(
r -> r.setTargetName(request.getTableNameCase().convert(r.getTargetName()))
);
return Result.success(result); return Result.success(result);
} }
@@ -104,6 +107,9 @@ public class PatternMapperService {
} }
} }
result.forEach(
r -> r.setTargetName(request.getColumnNameCase().convert(r.getTargetName()))
);
return Result.success(result); return Result.success(result);
} finally { } finally {
service.close(); service.close();

View File

@@ -0,0 +1,3 @@
ALTER TABLE `DBSWITCH_ASSIGNMENT_CONFIG`
ADD COLUMN `table_name_case` varchar(32) NOT NULL DEFAULT 'NONE' COMMENT '表名大小写转换策略' AFTER `target_schema`,
ADD COLUMN `column_name_case` varchar(32) NOT NULL DEFAULT 'NONE' COMMENT '列名大小写转换策略' AFTER `table_name_case`;

View File

@@ -115,6 +115,8 @@ CREATE TABLE IF NOT EXISTS DBSWITCH_ASSIGNMENT_CONFIG (
"source_tables" text , "source_tables" text ,
"excluded" boolean not null default false, "excluded" boolean not null default false,
"target_connection_id" int8 not null, "target_connection_id" int8 not null,
"table_name_case" varchar(32) not null default 'NONE',
"column_name_case" varchar(32) not null default 'NONE',
"target_schema" varchar(200) not null, "target_schema" varchar(200) not null,
"table_name_map" text , "table_name_map" text ,
"column_name_map" text , "column_name_map" text ,
@@ -139,6 +141,8 @@ COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."source_tables" IS '来源端的tab
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."excluded" IS '是否排除(0:否 1:是)'; COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."excluded" IS '是否排除(0:否 1:是)';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."target_connection_id" IS '目的端连接ID'; 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."target_schema" IS '目的端的schema(一个)';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."table_name_case" IS '表名大小写转换策略';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."column_name_case" IS '列名大小写转换策略';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."table_name_map" IS '表名映射关系'; COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."table_name_map" IS '表名映射关系';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."column_name_map" IS '字段名映射关系'; COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."column_name_map" IS '字段名映射关系';
COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."target_drop_table" IS '同步前是否先删除目的表(0:否 1:是)'; COMMENT ON COLUMN DBSWITCH_ASSIGNMENT_CONFIG."target_drop_table" IS '同步前是否先删除目的表(0:否 1:是)';

View File

@@ -1 +1 @@
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>异构数据迁移工具</title><link href=/static/css/app.881c13c2631dcfe8bfddbc741e37afe8.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.416ae36371fbd60a9d0c.js></script><script type=text/javascript src=/static/js/vendor.a3e6dafc4ec8793dd626.js></script><script type=text/javascript src=/static/js/app.7b649155b9133623ccab.js></script></body></html> <!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>异构数据迁移工具</title><link href=/static/css/app.d32de86bf73d91875b8703ccf4df784b.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.77cf875651e80e93b9d5.js></script><script type=text/javascript src=/static/js/vendor.a3e6dafc4ec8793dd626.js></script><script type=text/javascript src=/static/js/app.a7a6316fe14fe86c7a6f.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
webpackJsonp([13],{WfA7:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a={data:function(){return{dialogVisible:!1,loading:!0,connectionTypes:[],versionDrivers:[],isActive:-1}},methods:{loadConnectionTypes:function(){var t=this;this.$http({method:"GET",url:"/dbswitch/admin/api/v1/connection/types"}).then(function(e){0===e.data.code?t.connectionTypes=e.data.data:e.data.message&&alert("初始化数据库类型信息失败:"+e.data.message)})},handleChooseClick:function(t,e){var i=this;this.isActive=e,this.$http.get("/dbswitch/admin/api/v1/connection/"+t+"/drivers").then(function(t){0===t.data.code?i.versionDrivers=t.data.data:t.data.message&&alert("查询驱动版本信息失败,"+t.data.message)})},handleClose:function(t){this.$confirm("确认关闭?").then(function(e){t()}).catch(function(t){})},formatJarFileList:function(t,e){return t[e.property].join(";\n")}},created:function(){this.loadConnectionTypes()},beforeDestroy:function(){}},n={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("el-card",[i("div",{staticClass:"container"},[i("el-card",{staticClass:"box-card"},[i("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[i("span",[t._v("数据库类型列表")])]),t._v(" "),i("div",{staticClass:"navsBox"},[i("ul",t._l(t.connectionTypes,function(e,a){return i("li",{key:a,class:{active:a==t.isActive},on:{click:function(i){return t.handleChooseClick(e.type,a)}}},[t._v("["+t._s(e.id)+"]"+t._s(e.type))])}),0)])]),t._v(" "),i("div",{staticClass:"contentBox"},[i("div",{staticStyle:{margin:"10px 5px"},attrs:{align:"right",width:"95%"}},[i("el-button",{attrs:{type:"primary",icon:"el-icon-document-add"},on:{click:function(e){t.dialogVisible=!0}}},[t._v("添加驱动")])],1),t._v(" "),i("el-table",{attrs:{"header-cell-style":{background:"#eef1f6",color:"#606266"},data:t.versionDrivers,size:"small",stripe:"",border:""}},[i("template",{slot:"empty"},[i("span",[t._v("单击左侧数据库类型来查看对应的驱动版本信息")])]),t._v(" "),i("el-table-column",{attrs:{property:"driverVersion",label:"驱动版本号","min-width":"15%"}}),t._v(" "),i("el-table-column",{attrs:{property:"driverClass",label:"驱动类名","min-width":"20%"}}),t._v(" "),i("el-table-column",{attrs:{property:"jarFiles",formatter:t.formatJarFileList,label:"驱动JAR名称","min-width":"30%"}}),t._v(" "),i("el-table-column",{attrs:{property:"driverPath",label:"驱动版本路径","min-width":"50%"}})],2)],1)],1)]),t._v(" "),i("el-dialog",{attrs:{title:"添加数据库驱动JAR说明",visible:t.dialogVisible,width:"40%","before-close":t.handleClose},on:{"update:visible":function(e){t.dialogVisible=e}}},[i("span",[t._v("请按照驱动路径所在的目录${DBSWITCH_HOME}/drivers下在数据库类型为名称的目录下以驱动版本号为名称创建目录并放置对应的驱动jar文件然后重启即可生效。具体可参考https://gitee.com/inrgihc/dbswitch/tree/master/drivers下的目录结构。")]),t._v(" "),i("span"),t._v(" "),i("span",[t._v("特殊说明驱动版本目录下的所有JAR必须无任何外部依赖否则也需将其依赖JAR一起放置到对应的目录下。")]),t._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v("取 消")]),t._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogVisible=!1}}},[t._v("确 定")])],1)])],1)},staticRenderFns:[]};var s=i("VU/8")(a,n,!1,function(t){i("g7vK")},"data-v-5f908938",null);e.default=s.exports},g7vK:function(t,e){}}); webpackJsonp([14],{WfA7:function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var a={data:function(){return{dialogVisible:!1,loading:!0,connectionTypes:[],versionDrivers:[],isActive:-1}},methods:{loadConnectionTypes:function(){var t=this;this.$http({method:"GET",url:"/dbswitch/admin/api/v1/connection/types"}).then(function(e){0===e.data.code?t.connectionTypes=e.data.data:e.data.message&&alert("初始化数据库类型信息失败:"+e.data.message)})},handleChooseClick:function(t,e){var i=this;this.isActive=e,this.$http.get("/dbswitch/admin/api/v1/connection/"+t+"/drivers").then(function(t){0===t.data.code?i.versionDrivers=t.data.data:t.data.message&&alert("查询驱动版本信息失败,"+t.data.message)})},handleClose:function(t){this.$confirm("确认关闭?").then(function(e){t()}).catch(function(t){})},formatJarFileList:function(t,e){return t[e.property].join(";\n")}},created:function(){this.loadConnectionTypes()},beforeDestroy:function(){}},n={render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",[i("el-card",[i("div",{staticClass:"container"},[i("el-card",{staticClass:"box-card"},[i("div",{staticClass:"clearfix",attrs:{slot:"header"},slot:"header"},[i("span",[t._v("数据库类型列表")])]),t._v(" "),i("div",{staticClass:"navsBox"},[i("ul",t._l(t.connectionTypes,function(e,a){return i("li",{key:a,class:{active:a==t.isActive},on:{click:function(i){return t.handleChooseClick(e.type,a)}}},[t._v("["+t._s(e.id)+"]"+t._s(e.type))])}),0)])]),t._v(" "),i("div",{staticClass:"contentBox"},[i("div",{staticStyle:{margin:"10px 5px"},attrs:{align:"right",width:"95%"}},[i("el-button",{attrs:{type:"primary",icon:"el-icon-document-add"},on:{click:function(e){t.dialogVisible=!0}}},[t._v("添加驱动")])],1),t._v(" "),i("el-table",{attrs:{"header-cell-style":{background:"#eef1f6",color:"#606266"},data:t.versionDrivers,size:"small",stripe:"",border:""}},[i("template",{slot:"empty"},[i("span",[t._v("单击左侧数据库类型来查看对应的驱动版本信息")])]),t._v(" "),i("el-table-column",{attrs:{property:"driverVersion",label:"驱动版本号","min-width":"15%"}}),t._v(" "),i("el-table-column",{attrs:{property:"driverClass",label:"驱动类名","min-width":"20%"}}),t._v(" "),i("el-table-column",{attrs:{property:"jarFiles",formatter:t.formatJarFileList,label:"驱动JAR名称","min-width":"30%"}}),t._v(" "),i("el-table-column",{attrs:{property:"driverPath",label:"驱动版本路径","min-width":"50%"}})],2)],1)],1)]),t._v(" "),i("el-dialog",{attrs:{title:"添加数据库驱动JAR说明",visible:t.dialogVisible,width:"40%","before-close":t.handleClose},on:{"update:visible":function(e){t.dialogVisible=e}}},[i("span",[t._v("请按照驱动路径所在的目录${DBSWITCH_HOME}/drivers下在数据库类型为名称的目录下以驱动版本号为名称创建目录并放置对应的驱动jar文件然后重启即可生效。具体可参考https://gitee.com/inrgihc/dbswitch/tree/master/drivers下的目录结构。")]),t._v(" "),i("span"),t._v(" "),i("span",[t._v("特殊说明驱动版本目录下的所有JAR必须无任何外部依赖否则也需将其依赖JAR一起放置到对应的目录下。")]),t._v(" "),i("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[i("el-button",{on:{click:function(e){t.dialogVisible=!1}}},[t._v("取 消")]),t._v(" "),i("el-button",{attrs:{type:"primary"},on:{click:function(e){t.dialogVisible=!1}}},[t._v("确 定")])],1)])],1)},staticRenderFns:[]};var s=i("VU/8")(a,n,!1,function(t){i("g7vK")},"data-v-5f908938",null);e.default=s.exports},g7vK:function(t,e){}});
//# sourceMappingURL=13.9abc500b5698aadde0b0.js.map //# sourceMappingURL=14.cf28f7dc3d2e1f1276e9.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
webpackJsonp([19],{NHnr:function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=t("//Fk"),r=t.n(o),c=t("7+uW"),a={render:function(){var n=this.$createElement,e=this._self._c||n;return e("div",{staticClass:"body-wrapper"},[e("router-view")],1)},staticRenderFns:[]};var i=t("VU/8")({name:"App"},a,!1,function(n){t("Pibb")},"data-v-a97617c2",null).exports,u=t("/ocq");c.default.use(u.a);var l=new u.a({routes:[{path:"/",name:"首页",component:function(){return t.e(4).then(t.bind(null,"4er+"))},redirect:"/dashboard",children:[{path:"/dashboard",name:"概览",icon:"el-icon-menu",component:function(){return Promise.all([t.e(0),t.e(9)]).then(t.bind(null,"ARoL"))}},{path:"/connection",name:"连接配置",icon:"el-icon-s-order",component:function(){return t.e(8).then(t.bind(null,"Hoc+"))},children:[{path:"/connection/driver",name:"驱动配置",icon:"el-icon-help",component:function(){return t.e(13).then(t.bind(null,"WfA7"))}},{path:"/connection/list",name:"连接管理",icon:"el-icon-bank-card",component:function(){return Promise.all([t.e(0),t.e(10)]).then(t.bind(null,"qdtB"))}}]},{path:"/metadata",name:"数据目录",icon:"el-icon-coin",component:function(){return t.e(1).then(t.bind(null,"PJ2q"))}},{path:"/task",name:"任务管理",icon:"el-icon-s-tools",component:function(){return t.e(6).then(t.bind(null,"4KEO"))},children:[{path:"/task/assignment",name:"任务安排",icon:"el-icon-eleme",component:function(){return Promise.all([t.e(0),t.e(16)]).then(t.bind(null,"D0I9"))}},{path:"/task/schedule",name:"调度记录",icon:"el-icon-pie-chart",component:function(){return t.e(17).then(t.bind(null,"mKp/"))}}]},{path:"/log",name:"审计日志",icon:"el-icon-platform-eleme",component:function(){return t.e(7).then(t.bind(null,"QWih"))},children:[{path:"/log/access",name:"登录日志",icon:"el-icon-place",component:function(){return t.e(12).then(t.bind(null,"oQRv"))}},{path:"/log/action",name:"操作日志",icon:"el-icon-s-check",component:function(){return t.e(11).then(t.bind(null,"0eSS"))}}]},{path:"/about",name:"关于系统",icon:"el-icon-s-custom",component:function(){return t.e(2).then(t.bind(null,"m25N"))}},{path:"/user/personal",name:"个人中心",hidden:!0,component:function(){return t.e(3).then(t.bind(null,"uTKz"))}},{path:"/task/create",name:"创建任务",hidden:!0,component:function(){return Promise.all([t.e(0),t.e(15)]).then(t.bind(null,"/rCC"))}},{path:"/task/update",name:"修改任务",hidden:!0,component:function(){return Promise.all([t.e(0),t.e(14)]).then(t.bind(null,"txod"))}}]},{path:"/login",name:"登录",component:function(){return t.e(5).then(t.bind(null,"T+/8"))}}]}),p=t("mtWM"),d=t.n(p).a.create();d.interceptors.request.use(function(n){return n.url=""+n.url,n});var s=d,h=t("zL8q"),m=t.n(h),f=(t("muQq"),t("tvR6"),t("7Vno")),b=t.n(f),v=t("XLwt"),g=t.n(v);c.default.use(s),c.default.use(m.a),c.default.use(b.a),c.default.prototype.$http=s,c.default.config.productionTip=!1,c.default.prototype.$echarts=g.a,s.interceptors.request.use(function(n){var e=sessionStorage.getItem("token");return e&&(n.headers.Authorization="Bearer "+e),n},function(n){return r.a.reject(n)}),s.interceptors.response.use(function(n){return!n.data||401!==n.data.code&&403!==n.data.code&&404!==n.data.code||l.push({path:"/login"}),n},function(n){return console.log(n),r.a.reject(n.response)}),new c.default({el:"#app",router:l,components:{App:i},template:"<App/>"})},Pibb:function(n,e){},muQq:function(n,e){},tvR6:function(n,e){}},["NHnr"]); webpackJsonp([19],{NHnr:function(n,e,t){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=t("//Fk"),r=t.n(o),c=t("7+uW"),a={render:function(){var n=this.$createElement,e=this._self._c||n;return e("div",{staticClass:"body-wrapper"},[e("router-view")],1)},staticRenderFns:[]};var i=t("VU/8")({name:"App"},a,!1,function(n){t("Pibb")},"data-v-a97617c2",null).exports,u=t("/ocq");c.default.use(u.a);var l=new u.a({routes:[{path:"/",name:"首页",component:function(){return t.e(4).then(t.bind(null,"4er+"))},redirect:"/dashboard",children:[{path:"/dashboard",name:"概览",icon:"el-icon-menu",component:function(){return Promise.all([t.e(0),t.e(9)]).then(t.bind(null,"ARoL"))}},{path:"/connection",name:"连接配置",icon:"el-icon-s-order",component:function(){return t.e(8).then(t.bind(null,"Hoc+"))},children:[{path:"/connection/driver",name:"驱动配置",icon:"el-icon-help",component:function(){return t.e(14).then(t.bind(null,"WfA7"))}},{path:"/connection/list",name:"连接管理",icon:"el-icon-bank-card",component:function(){return Promise.all([t.e(0),t.e(10)]).then(t.bind(null,"qdtB"))}}]},{path:"/metadata",name:"数据目录",icon:"el-icon-coin",component:function(){return t.e(1).then(t.bind(null,"PJ2q"))}},{path:"/task",name:"任务管理",icon:"el-icon-s-tools",component:function(){return t.e(6).then(t.bind(null,"4KEO"))},children:[{path:"/task/assignment",name:"任务安排",icon:"el-icon-eleme",component:function(){return Promise.all([t.e(0),t.e(16)]).then(t.bind(null,"D0I9"))}},{path:"/task/schedule",name:"调度记录",icon:"el-icon-pie-chart",component:function(){return t.e(17).then(t.bind(null,"mKp/"))}}]},{path:"/log",name:"审计日志",icon:"el-icon-platform-eleme",component:function(){return t.e(7).then(t.bind(null,"QWih"))},children:[{path:"/log/access",name:"登录日志",icon:"el-icon-place",component:function(){return t.e(12).then(t.bind(null,"oQRv"))}},{path:"/log/action",name:"操作日志",icon:"el-icon-s-check",component:function(){return t.e(11).then(t.bind(null,"0eSS"))}}]},{path:"/about",name:"关于系统",icon:"el-icon-s-custom",component:function(){return t.e(2).then(t.bind(null,"m25N"))}},{path:"/user/personal",name:"个人中心",hidden:!0,component:function(){return t.e(3).then(t.bind(null,"uTKz"))}},{path:"/task/create",name:"创建任务",hidden:!0,component:function(){return Promise.all([t.e(0),t.e(13)]).then(t.bind(null,"/rCC"))}},{path:"/task/update",name:"修改任务",hidden:!0,component:function(){return Promise.all([t.e(0),t.e(15)]).then(t.bind(null,"txod"))}}]},{path:"/login",name:"登录",component:function(){return t.e(5).then(t.bind(null,"T+/8"))}}]}),p=t("mtWM"),d=t.n(p).a.create();d.interceptors.request.use(function(n){return n.url=""+n.url,n});var s=d,h=t("zL8q"),m=t.n(h),f=(t("muQq"),t("tvR6"),t("7Vno")),b=t.n(f),v=t("XLwt"),g=t.n(v);c.default.use(s),c.default.use(m.a),c.default.use(b.a),c.default.prototype.$http=s,c.default.config.productionTip=!1,c.default.prototype.$echarts=g.a,s.interceptors.request.use(function(n){var e=sessionStorage.getItem("token");return e&&(n.headers.Authorization="Bearer "+e),n},function(n){return r.a.reject(n)}),s.interceptors.response.use(function(n){return!n.data||401!==n.data.code&&403!==n.data.code&&404!==n.data.code||l.push({path:"/login"}),n},function(n){return console.log(n),r.a.reject(n.response)}),new c.default({el:"#app",router:l,components:{App:i},template:"<App/>"})},Pibb:function(n,e){},muQq:function(n,e){},tvR6:function(n,e){}},["NHnr"]);
//# sourceMappingURL=app.7b649155b9133623ccab.js.map //# sourceMappingURL=app.a7a6316fe14fe86c7a6f.js.map

View File

@@ -1,2 +0,0 @@
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,a,o){for(var d,f,i,u=0,b=[];u<r.length;u++)f=r[u],t[f]&&b.push(t[f][0]),t[f]=0;for(d in a)Object.prototype.hasOwnProperty.call(a,d)&&(e[d]=a[d]);for(n&&n(r,a,o);b.length;)b.shift()();if(o)for(u=0;u<o.length;u++)i=c(c.s=o[u]);return i};var r={},t={20:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var a=document.getElementsByTagName("head")[0],o=document.createElement("script");o.type="text/javascript",o.charset="utf-8",o.async=!0,o.timeout=12e4,c.nc&&o.setAttribute("nonce",c.nc),o.src=c.p+"static/js/"+e+"."+{0:"ca67e87d8c000a42e592",1:"d0db995e4146b5e72cf1",2:"e8530496bfc5633541cd",3:"d4c1dc7b68edb49b61d2",4:"c4abd62fbe15189d37a5",5:"837a4a67f1fcf6ee6c6a",6:"7f56c2238fb7e4ee2ecd",7:"d5dc80a855f66a3208ff",8:"0b82703c6f3d2dd72354",9:"9b19245845e7fa49300a",10:"b9e09bc05c7d8239e93b",11:"c61c0ebee350b7e0cba3",12:"e59d78e330bd5e2703c1",13:"9abc500b5698aadde0b0",14:"caabaf113d764d207ca1",15:"be90841c2cb7f85518ca",16:"aeaac7f46732356168a8",17:"953b93ad4217ddda621f"}[e]+".js";var d=setTimeout(f,12e4);function f(){o.onerror=o.onload=null,clearTimeout(d);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return o.onerror=o.onload=f,a.appendChild(o),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="/",c.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.416ae36371fbd60a9d0c.js.map

View File

@@ -0,0 +1,2 @@
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,o,a){for(var f,d,i,u=0,b=[];u<r.length;u++)d=r[u],t[d]&&b.push(t[d][0]),t[d]=0;for(f in o)Object.prototype.hasOwnProperty.call(o,f)&&(e[f]=o[f]);for(n&&n(r,o,a);b.length;)b.shift()();if(a)for(u=0;u<a.length;u++)i=c(c.s=a[u]);return i};var r={},t={20:0};function c(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,c),t.l=!0,t.exports}c.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,c){n=t[e]=[r,c]});n[2]=r;var o=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,c.nc&&a.setAttribute("nonce",c.nc),a.src=c.p+"static/js/"+e+"."+{0:"ca67e87d8c000a42e592",1:"d0db995e4146b5e72cf1",2:"e8530496bfc5633541cd",3:"d4c1dc7b68edb49b61d2",4:"c4abd62fbe15189d37a5",5:"837a4a67f1fcf6ee6c6a",6:"7f56c2238fb7e4ee2ecd",7:"d5dc80a855f66a3208ff",8:"0b82703c6f3d2dd72354",9:"9b19245845e7fa49300a",10:"b9e09bc05c7d8239e93b",11:"c61c0ebee350b7e0cba3",12:"e59d78e330bd5e2703c1",13:"1a23a103b05b99d58001",14:"cf28f7dc3d2e1f1276e9",15:"c8f8271138d0a2e8e5cc",16:"aeaac7f46732356168a8",17:"953b93ad4217ddda621f"}[e]+".js";var f=setTimeout(d,12e4);function d(){a.onerror=a.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=d,o.appendChild(a),r},c.m=e,c.c=r,c.d=function(e,n,r){c.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},c.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(n,"a",n),n},c.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},c.p="/",c.oe=function(e){throw console.error(e),e}}([]);
//# sourceMappingURL=manifest.77cf875651e80e93b9d5.js.map

View File

@@ -0,0 +1,87 @@
// Copyright tang. All rights reserved.
// https://gitee.com/inrgihc/dbswitch
//
// Use of this source code is governed by a BSD-style license
//
// Author: tang (inrgihc@126.com)
// Date : 2020/1/2
// Location: beijing , china
/////////////////////////////////////////////////////////////
package com.gitee.dbswitch.common.entity;
import com.gitee.dbswitch.common.util.ExamineUtils;
import java.io.File;
import java.io.FileFilter;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
public class JarClassLoader extends URLClassLoader {
public JarClassLoader(String path, ClassLoader parent) {
this(new String[]{path}, parent);
}
public JarClassLoader(String[] paths, ClassLoader parent) {
super(getURLs(paths), parent);
}
private static URL[] getURLs(String[] paths) {
ExamineUtils.checkArgument(
null != paths && 0 != paths.length,
"jar file path is empty.");
List<String> dirs = new ArrayList<>();
for (String path : paths) {
dirs.add(path);
collectDirs(path, dirs);
}
List<URL> urls = new ArrayList<>();
for (String path : dirs) {
urls.addAll(doGetURLs(path));
}
if(urls.isEmpty()){
throw new RuntimeException("No jar file found from path :" + paths + "!");
}
return urls.toArray(new URL[0]);
}
private static void collectDirs(String path, List<String> collector) {
if (StringUtils.isEmpty(path)) {
return;
}
File current = new File(path);
if (!current.exists() || !current.isDirectory()) {
return;
}
for (File child : current.listFiles()) {
if (!child.isDirectory()) {
continue;
}
collector.add(child.getAbsolutePath());
collectDirs(child.getAbsolutePath(), collector);
}
}
private static List<URL> doGetURLs(final String path) {
ExamineUtils.checkArgument(StringUtils.isNotBlank(path), "jar path is empty.");
File jarPath = new File(path);
if (!jarPath.exists() || !jarPath.isDirectory()) {
return Collections.emptyList();
}
FileFilter jarFilter = name -> name.getName().endsWith(".jar");
File[] allJars = new File(path).listFiles(jarFilter);
List<URL> jarURLs = new ArrayList<>(allJars.length);
for (int i = 0; i < allJars.length; i++) {
try {
jarURLs.add(allJars[i].toURI().toURL());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return jarURLs;
}
}

View File

@@ -0,0 +1,36 @@
// Copyright tang. All rights reserved.
// https://gitee.com/inrgihc/dbswitch
//
// Use of this source code is governed by a BSD-style license
//
// Author: tang (inrgihc@126.com)
// Date : 2020/1/2
// Location: beijing , china
/////////////////////////////////////////////////////////////
package com.gitee.dbswitch.common.type;
/**
* 处理大小写转换的枚举类
*/
public enum CaseConvertEnum {
NONE(s -> s),
UPPER(String::toUpperCase),
LOWER(String::toLowerCase),
;
private Converter function;
CaseConvertEnum(Converter function) {
this.function = function;
}
public String convert(String name) {
return function.convert(name);
}
interface Converter {
String convert(String s);
}
}

View File

@@ -1,3 +1,12 @@
// Copyright tang. All rights reserved.
// https://gitee.com/inrgihc/dbswitch
//
// Use of this source code is governed by a BSD-style license
//
// Author: tang (inrgihc@126.com)
// Date : 2020/1/2
// Location: beijing , china
/////////////////////////////////////////////////////////////
package com.gitee.dbswitch.common.util; package com.gitee.dbswitch.common.util;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;

View File

@@ -24,7 +24,8 @@ public class AutoCastTableDataSynchronizer extends DefaultTableDataSynchronizer
public long executeUpdate(List<Object[]> records) { public long executeUpdate(List<Object[]> records) {
records.forEach((Object[] row) -> { records.forEach((Object[] row) -> {
for (int i = 0; i < row.length; ++i) { for (int i = 0; i < row.length; ++i) {
row[i] = ObjectCastUtils.castByJdbcType(updateArgsType[i], row[i]); //row[i] = ObjectCastUtils.castByJdbcType(updateArgsType[i], row[i]);
row[i] = ObjectCastUtils.castByDetermine(row[i]);
} }
}); });
return super.executeUpdate(records); return super.executeUpdate(records);

View File

@@ -9,6 +9,7 @@
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
package com.gitee.dbswitch.data.entity; package com.gitee.dbswitch.data.entity;
import com.gitee.dbswitch.common.type.CaseConvertEnum;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import lombok.Data; import lombok.Data;
@@ -24,6 +25,8 @@ public class TargetDataSourceProperties {
private Long maxLifeTime = TimeUnit.MINUTES.toMillis(30); private Long maxLifeTime = TimeUnit.MINUTES.toMillis(30);
private String targetSchema = ""; private String targetSchema = "";
private CaseConvertEnum tableNameCase = CaseConvertEnum.NONE;
private CaseConvertEnum columnNameCase = CaseConvertEnum.NONE;
private Boolean targetDrop = Boolean.TRUE; private Boolean targetDrop = Boolean.TRUE;
private Boolean onlyCreate = Boolean.FALSE; private Boolean onlyCreate = Boolean.FALSE;
private Boolean createTableAutoIncrement = Boolean.FALSE; private Boolean createTableAutoIncrement = Boolean.FALSE;

View File

@@ -18,6 +18,7 @@ import com.gitee.dbswitch.calculate.TaskParamEntity;
import com.gitee.dbswitch.common.consts.Constants; import com.gitee.dbswitch.common.consts.Constants;
import com.gitee.dbswitch.common.entity.CloseableDataSource; import com.gitee.dbswitch.common.entity.CloseableDataSource;
import com.gitee.dbswitch.common.entity.ResultSetWrapper; import com.gitee.dbswitch.common.entity.ResultSetWrapper;
import com.gitee.dbswitch.common.type.CaseConvertEnum;
import com.gitee.dbswitch.common.type.ProductTypeEnum; import com.gitee.dbswitch.common.type.ProductTypeEnum;
import com.gitee.dbswitch.common.util.DatabaseAwareUtils; import com.gitee.dbswitch.common.util.DatabaseAwareUtils;
import com.gitee.dbswitch.common.util.ExamineUtils; import com.gitee.dbswitch.common.util.ExamineUtils;
@@ -118,11 +119,26 @@ public class MigrationHandler implements Supplier<Long> {
fetchSize = sourceProperties.getFetchSize(); fetchSize = sourceProperties.getFetchSize();
} }
this.sourceProductType = DatabaseAwareUtils.getProductTypeByDataSource(sourceDataSource);
this.targetProductType = DatabaseAwareUtils.getProductTypeByDataSource(targetDataSource);
if (this.targetProductType.isLikeHive()) {
// !! hive does not support upper table name and column name
properties.getTarget().setTableNameCase(CaseConvertEnum.LOWER);
properties.getTarget().setColumnNameCase(CaseConvertEnum.LOWER);
}
this.targetExistTables = targetExistTables; this.targetExistTables = targetExistTables;
// 获取映射转换后新的表名 // 获取映射转换后新的表名
this.targetSchemaName = properties.getTarget().getTargetSchema(); this.targetSchemaName = properties.getTarget().getTargetSchema();
this.targetTableName = PatterNameUtils.getFinalName(td.getTableName(), this.targetTableName = properties.getTarget()
sourceProperties.getRegexTableMapper()); .getTableNameCase()
.convert(
PatterNameUtils.getFinalName(
td.getTableName(),
sourceProperties.getRegexTableMapper()
)
);
if (StringUtils.isEmpty(this.targetTableName)) { if (StringUtils.isEmpty(this.targetTableName)) {
throw new RuntimeException("表名的映射规则配置有误,不能将[" + this.sourceTableName + "]映射为空"); throw new RuntimeException("表名的映射规则配置有误,不能将[" + this.sourceTableName + "]映射为空");
@@ -141,10 +157,7 @@ public class MigrationHandler implements Supplier<Long> {
public Long get() { public Long get() {
log.info("Begin Migrate table for {}", tableNameMapString); log.info("Begin Migrate table for {}", tableNameMapString);
this.sourceProductType = DatabaseAwareUtils.getProductTypeByDataSource(sourceDataSource); this.sourceMetaDataService = new DefaultMetadataService(sourceDataSource, sourceProductType);
this.targetProductType = DatabaseAwareUtils.getProductTypeByDataSource(targetDataSource);
this.sourceMetaDataService = new DefaultMetadataService(sourceDataSource,
sourceProductType);
// 读取源表的表及字段元数据 // 读取源表的表及字段元数据
this.sourceTableRemarks = sourceMetaDataService this.sourceTableRemarks = sourceMetaDataService
@@ -157,9 +170,12 @@ public class MigrationHandler implements Supplier<Long> {
// 根据表的列名映射转换准备目标端表的字段信息 // 根据表的列名映射转换准备目标端表的字段信息
this.targetColumnDescriptions = sourceColumnDescriptions.stream() this.targetColumnDescriptions = sourceColumnDescriptions.stream()
.map(column -> { .map(column -> {
String newName = PatterNameUtils.getFinalName( String newName = properties.getTarget().getColumnNameCase()
column.getFieldName(), .convert(
sourceProperties.getRegexColumnMapper()); PatterNameUtils.getFinalName(
column.getFieldName(),
sourceProperties.getRegexColumnMapper())
);
ColumnDescription description = column.copy(); ColumnDescription description = column.copy();
description.setFieldName(newName); description.setFieldName(newName);
description.setLabelName(newName); description.setLabelName(newName);
@@ -167,7 +183,12 @@ public class MigrationHandler implements Supplier<Long> {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
this.targetPrimaryKeys = sourcePrimaryKeys.stream() this.targetPrimaryKeys = sourcePrimaryKeys.stream()
.map(name -> .map(name ->
PatterNameUtils.getFinalName(name, sourceProperties.getRegexColumnMapper()) properties.getTarget().getColumnNameCase()
.convert(
PatterNameUtils.getFinalName(
name,
sourceProperties.getRegexColumnMapper())
)
).collect(Collectors.toList()); ).collect(Collectors.toList());
// 打印表名与字段名的映射关系 // 打印表名与字段名的映射关系

View File

@@ -12,29 +12,20 @@ package com.gitee.dbswitch.data.util;
import cn.hutool.core.util.ClassLoaderUtil; import cn.hutool.core.util.ClassLoaderUtil;
import com.gitee.dbswitch.common.entity.CloseableDataSource; import com.gitee.dbswitch.common.entity.CloseableDataSource;
import com.gitee.dbswitch.common.entity.InvisibleDataSource; import com.gitee.dbswitch.common.entity.InvisibleDataSource;
import com.gitee.dbswitch.common.entity.JarClassLoader;
import com.gitee.dbswitch.common.util.ExamineUtils;
import com.gitee.dbswitch.data.domain.WrapCommonDataSource; import com.gitee.dbswitch.data.domain.WrapCommonDataSource;
import com.gitee.dbswitch.data.domain.WrapHikariDataSource; import com.gitee.dbswitch.data.domain.WrapHikariDataSource;
import com.gitee.dbswitch.data.entity.SourceDataSourceProperties; import com.gitee.dbswitch.data.entity.SourceDataSourceProperties;
import com.gitee.dbswitch.data.entity.TargetDataSourceProperties; import com.gitee.dbswitch.data.entity.TargetDataSourceProperties;
import com.zaxxer.hikari.HikariDataSource; import com.zaxxer.hikari.HikariDataSource;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Connection; import java.sql.Connection;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.Properties; import java.util.Properties;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.sql.DataSource; import javax.sql.DataSource;
import lombok.experimental.UtilityClass; import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -58,7 +49,8 @@ public final class DataSourceUtils {
* @param properties 数据库连接描述符 * @param properties 数据库连接描述符
* @return HikariDataSource连接池 * @return HikariDataSource连接池
*/ */
public static CloseableDataSource createSourceDataSource(SourceDataSourceProperties properties) { public static CloseableDataSource createSourceDataSource(
SourceDataSourceProperties properties) {
Properties parameters = new Properties(); Properties parameters = new Properties();
HikariDataSource ds = new HikariDataSource(); HikariDataSource ds = new HikariDataSource();
ds.setPoolName("The_Source_DB_Connection"); ds.setPoolName("The_Source_DB_Connection");
@@ -102,7 +94,8 @@ public final class DataSourceUtils {
* @param properties 数据库连接描述符 * @param properties 数据库连接描述符
* @return HikariDataSource连接池 * @return HikariDataSource连接池
*/ */
public static CloseableDataSource createTargetDataSource(TargetDataSourceProperties properties) { public static CloseableDataSource createTargetDataSource(
TargetDataSourceProperties properties) {
HikariDataSource ds = new HikariDataSource(); HikariDataSource ds = new HikariDataSource();
ds.setPoolName("The_Target_DB_Connection"); ds.setPoolName("The_Target_DB_Connection");
ds.setJdbcUrl(properties.getUrl()); ds.setJdbcUrl(properties.getUrl());
@@ -151,10 +144,15 @@ public final class DataSourceUtils {
return new WrapHikariDataSource(ds, urlClassLoader); return new WrapHikariDataSource(ds, urlClassLoader);
} }
public static CloseableDataSource createCommonDataSource(String jdbcUrl, public static CloseableDataSource createCommonDataSource(
String driverClass, String driverPath, String jdbcUrl,
String username, String password) { String driverClass,
URLClassLoader urlClassLoader = createURLClassLoader(driverPath, driverClass); String driverPath,
String username,
String password) {
URLClassLoader urlClassLoader = createURLClassLoader(
driverPath,
driverClass);
InvisibleDataSource dataSource = createInvisibleDataSource( InvisibleDataSource dataSource = createInvisibleDataSource(
urlClassLoader, urlClassLoader,
jdbcUrl, jdbcUrl,
@@ -166,65 +164,46 @@ public final class DataSourceUtils {
return new WrapCommonDataSource(dataSource, urlClassLoader); return new WrapCommonDataSource(dataSource, urlClassLoader);
} }
private static InvisibleDataSource createInvisibleDataSource(ClassLoader cl, private static InvisibleDataSource createInvisibleDataSource(
String jdbcUrl, String driverClass, String username, ClassLoader cl,
String password, Properties properties) { String jdbcUrl,
return new InvisibleDataSource(cl, jdbcUrl, driverClass, username, password, properties); String driverClass,
String username,
String password,
Properties properties) {
return new InvisibleDataSource(
cl,
jdbcUrl,
driverClass,
username,
password,
properties);
} }
private static URLClassLoader createURLClassLoader(String driverPath, String driverClass) { private static URLClassLoader createURLClassLoader(
if (StringUtils.isBlank(driverPath)) { String driverPath, String driverClass) {
throw new RuntimeException("Invalid driver path,can not be empty!"); ExamineUtils.checkArgument(
} StringUtils.isNoneBlank(driverPath),
if (StringUtils.isBlank(driverClass)) { "Invalid driver path,can not be empty!");
throw new RuntimeException("Invalid driver class,can not be empty!"); ExamineUtils.checkArgument(
} StringUtils.isNoneBlank(driverClass),
List<Path> filePaths = findJarFilesFromDirectory(driverPath); "Invalid driver class,can not be empty!");
if (filePaths.isEmpty()) {
throw new RuntimeException("No jar file found from path:" + driverPath + "!");
}
URL[] urls = filePaths.stream().map(path -> convertPath2URL(path)).toArray(URL[]::new);
ClassLoader parent = driverClass.contains("postgresql") ClassLoader parent = driverClass.contains("postgresql")
? ClassLoaderUtil.getContextClassLoader() ? ClassLoaderUtil.getContextClassLoader()
: ClassLoaderUtil.getSystemClassLoader().getParent(); : ClassLoaderUtil.getSystemClassLoader().getParent();
URLClassLoader loader = new URLClassLoader(urls, parent); URLClassLoader loader = new JarClassLoader(driverPath, parent);
try { try {
Class<?> clazz = loader.loadClass(driverClass); Class<?> clazz = loader.loadClass(driverClass);
clazz.newInstance(); clazz.getConstructor().newInstance();
return loader; return loader;
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) { } catch (Exception e) {
log.error("Could not load class : {} from driver path: {}", driverClass, driverPath, e); log.error("Could not load class : {} from driver path: {}", driverClass, driverPath, e);
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
private static URL convertPath2URL(Path path) { private static String executeStringReturnedSql(
try { DataSource dataSource, String sql) {
return path.toUri().toURL();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
}
}
public static List<Path> findJarFilesFromDirectory(String path) {
File file = new File(path);
if (!file.exists()) {
throw new RuntimeException("Path:" + path + " is not exists!");
}
Predicate<Path> fileFilter = f -> {
String fileName = f.toFile().getName();
return fileName.endsWith(".jar") || fileName.endsWith(".JAR");
};
try (Stream<Path> paths = Files.walk(Paths.get(path))) {
return paths.filter(Files::isRegularFile)
.filter(fileFilter)
.collect(Collectors.toList());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static String executeStringReturnedSql(DataSource dataSource, String sql) {
try (Connection connection = dataSource.getConnection()) { try (Connection connection = dataSource.getConnection()) {
try (Statement statement = connection.createStatement()) { try (Statement statement = connection.createStatement()) {
try (ResultSet resultSet = statement.executeQuery(sql)) { try (ResultSet resultSet = statement.executeQuery(sql)) {

View File

@@ -5,7 +5,7 @@ dbswitch:
## support multiple source database connection ## support multiple source database connection
- url: jdbc:mysql://172.17.2.10:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&tinyInt1isBit=false&rewriteBatchedStatements=true&useCompression=true - url: jdbc:mysql://172.17.2.10:3306/test?useUnicode=true&characterEncoding=utf-8&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&tinyInt1isBit=false&rewriteBatchedStatements=true&useCompression=true
driver-class-name: 'com.mysql.jdbc.Driver' driver-class-name: 'com.mysql.jdbc.Driver'
driver-path: D:/Workspace/dbswitch/drivers/mysql/mysql-5 driver-path: D:\Workspace\IdeaProjects\dbswitch\drivers\mysql\mysql-5
username: 'test' username: 'test'
password: '123456' password: '123456'
# source database configuration parameters # source database configuration parameters
@@ -31,12 +31,14 @@ dbswitch:
## Best support for Oracle/PostgreSQL/Greenplum/DM etc. ## Best support for Oracle/PostgreSQL/Greenplum/DM etc.
url: jdbc:postgresql://172.17.2.10:5432/test url: jdbc:postgresql://172.17.2.10:5432/test
driver-class-name: org.postgresql.Driver driver-class-name: org.postgresql.Driver
driver-path: D:/Workspace/dbswitch/drivers/postgresql/postgresql-11.4 driver-path: D:\Workspace\IdeaProjects\dbswitch\drivers\postgresql\postgresql-11.4
username: 'test' username: 'postgres'
password: '123456' password: '123456'
# target database configuration parameters # target database configuration parameters
## schema name for create/insert table data ## schema name for create/insert table data
target-schema: public target-schema: public
table-name-case: UPPER
column-name-case: UPPER
## whether drop-create table when target table exist ## whether drop-create table when target table exist
target-drop: true target-drop: true
## whether create table support auto increment for primary key field ## whether create table support auto increment for primary key field

View File

@@ -22,7 +22,7 @@ set APP_CONF_PATH=%APP_HOME%\conf
set APP_DRIVERS_PATH=%APP_HOME%\drivers set APP_DRIVERS_PATH=%APP_HOME%\drivers
::java虚拟机启动参数 ::java虚拟机启动参数
set JAVA_OPTS=-server -Xms4096m -Xmx4096m -Xmn2048m -XX:+DisableExplicitGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Doracle.jdbc.J2EE13Compliant=true set JAVA_OPTS=-server -Xms4096m -Xmx4096m -Xmn2048m -XX:+DisableExplicitGC -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Doracle.jdbc.J2EE13Compliant=true
::打印环境信息 ::打印环境信息
echo System Information: echo System Information:

View File

@@ -31,7 +31,7 @@ echo -n `date +'%Y-%m-%d %H:%M:%S'` >>${APP_RUN_LOG}
echo "---- Start service [${APP_MAIN}] process. ">>${APP_RUN_LOG} echo "---- Start service [${APP_MAIN}] process. ">>${APP_RUN_LOG}
# JVMFLAGS JVM参数可以在这里设置 # JVMFLAGS JVM参数可以在这里设置
JVMFLAGS="-Dfile.encoding=UTF-8 -server -Xms4096m -Xmx4096m -Xmn2048m -XX:+DisableExplicitGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:./gc.log" JVMFLAGS="-Dfile.encoding=UTF-8 -server -Xms4096m -Xmx4096m -Xmn2048m -XX:+DisableExplicitGC "
if [ "$JAVA_HOME" != "" ]; then if [ "$JAVA_HOME" != "" ]; then
JAVA="$JAVA_HOME/bin/java" JAVA="$JAVA_HOME/bin/java"