feat(web): 更新数据源配置并迁移数据库
- 修改 .idea/dataSources.xml 中的数据源配置,更新为新的 MySQL 数据源 - 更新 DataResourceController 中的属性名称,以适应新的数据库结构 - 修改 CsvResourceFormat、JsonLineResourceFormat 和 JsonResourceFormat 类中的属性名称 - 更新 application.yml 中的数据库配置,使用新的 MySQL 数据源 - 在 pom.xml 中添加 MySQL 连接器依赖,以支持新的数据库
This commit is contained in:
4
.idea/dataSources.xml
generated
4
.idea/dataSources.xml
generated
@@ -13,11 +13,11 @@
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="homeless" uuid="9af017b2-2a8b-45b4-899c-ef4fb185b77c">
|
||||
<data-source source="LOCAL" name="gringotts@132.122.1.185" uuid="91feafc5-32a2-4c28-93a7-b39754851328">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://frp-air.top:43458</jdbc-url>
|
||||
<jdbc-url>jdbc:mysql://132.122.1.185:31000/gringotts</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
<version>${hibernate.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
|
||||
@@ -174,18 +174,18 @@ public class DataResourceController extends SimpleControllerSupport<DataResource
|
||||
break;
|
||||
case JSON:
|
||||
JsonResourceFormat jsonFormat = (JsonResourceFormat) dataResource.getFormat();
|
||||
item.setJsonSchemaText(jsonFormat.getSchema());
|
||||
item.setJsonSchema(mapper.readValue(jsonFormat.getSchema(), Map.class));
|
||||
item.setJsonSchemaText(jsonFormat.getJsonSchema());
|
||||
item.setJsonSchema(mapper.readValue(jsonFormat.getJsonSchema(), Map.class));
|
||||
break;
|
||||
case JSON_LINE:
|
||||
JsonLineResourceFormat jsonLineFormat = (JsonLineResourceFormat) dataResource.getFormat();
|
||||
item.setJsonLineSchemaText(jsonLineFormat.getSchema());
|
||||
item.setJsonLineSchema(mapper.readValue(jsonLineFormat.getSchema(), Map.class));
|
||||
item.setJsonLineSchemaText(jsonLineFormat.getJsonSchema());
|
||||
item.setJsonLineSchema(mapper.readValue(jsonLineFormat.getJsonSchema(), Map.class));
|
||||
break;
|
||||
case CSV:
|
||||
CsvResourceFormat csvFormat = (CsvResourceFormat) dataResource.getFormat();
|
||||
item.setCsvSchemaText(csvFormat.getSchema());
|
||||
item.setCsvSchema(mapper.readValue(csvFormat.getSchema(), Map.class));
|
||||
item.setCsvSchemaText(csvFormat.getCsvSchema());
|
||||
item.setCsvSchema(mapper.readValue(csvFormat.getCsvSchema(), Map.class));
|
||||
break;
|
||||
}
|
||||
if (ObjectUtil.isNotNull(dataResource.getExample())) {
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.hibernate.annotations.Where;
|
||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
||||
public class CsvResourceFormat extends ResourceFormat {
|
||||
private String schema;
|
||||
private String csvSchema;
|
||||
|
||||
@Override
|
||||
public Type getFormatType() {
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.hibernate.annotations.Where;
|
||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
||||
public class JsonLineResourceFormat extends ResourceFormat {
|
||||
private String schema;
|
||||
private String jsonSchema;
|
||||
|
||||
@Override
|
||||
public Type getFormatType() {
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.hibernate.annotations.Where;
|
||||
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
||||
public class JsonResourceFormat extends ResourceFormat {
|
||||
private String schema;
|
||||
private String jsonSchema;
|
||||
|
||||
@Override
|
||||
public Type getFormatType() {
|
||||
|
||||
@@ -6,10 +6,10 @@ spring:
|
||||
profiles:
|
||||
include: common,metrics,encrypt
|
||||
datasource:
|
||||
url: jdbc:h2:./database;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
|
||||
username: lanyuanxiaoyao
|
||||
password: lanyuanxiaoyao
|
||||
driver-class-name: org.h2.Driver
|
||||
url: jdbc:mysql://132.122.1.185:31000/gringotts
|
||||
username: iap
|
||||
password: SLvwP6@SM2J*SbUw_iap
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
jpa:
|
||||
generate-ddl: true
|
||||
show-sql: true
|
||||
|
||||
Reference in New Issue
Block a user