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>
|
</jdbc-additional-properties>
|
||||||
<working-dir>$ProjectFileDir$</working-dir>
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
</data-source>
|
</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>
|
<driver-ref>mysql.8</driver-ref>
|
||||||
<synchronize>true</synchronize>
|
<synchronize>true</synchronize>
|
||||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
<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>
|
<jdbc-additional-properties>
|
||||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||||
|
|||||||
@@ -34,6 +34,10 @@
|
|||||||
<version>${hibernate.version}</version>
|
<version>${hibernate.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
|
|||||||
@@ -174,18 +174,18 @@ public class DataResourceController extends SimpleControllerSupport<DataResource
|
|||||||
break;
|
break;
|
||||||
case JSON:
|
case JSON:
|
||||||
JsonResourceFormat jsonFormat = (JsonResourceFormat) dataResource.getFormat();
|
JsonResourceFormat jsonFormat = (JsonResourceFormat) dataResource.getFormat();
|
||||||
item.setJsonSchemaText(jsonFormat.getSchema());
|
item.setJsonSchemaText(jsonFormat.getJsonSchema());
|
||||||
item.setJsonSchema(mapper.readValue(jsonFormat.getSchema(), Map.class));
|
item.setJsonSchema(mapper.readValue(jsonFormat.getJsonSchema(), Map.class));
|
||||||
break;
|
break;
|
||||||
case JSON_LINE:
|
case JSON_LINE:
|
||||||
JsonLineResourceFormat jsonLineFormat = (JsonLineResourceFormat) dataResource.getFormat();
|
JsonLineResourceFormat jsonLineFormat = (JsonLineResourceFormat) dataResource.getFormat();
|
||||||
item.setJsonLineSchemaText(jsonLineFormat.getSchema());
|
item.setJsonLineSchemaText(jsonLineFormat.getJsonSchema());
|
||||||
item.setJsonLineSchema(mapper.readValue(jsonLineFormat.getSchema(), Map.class));
|
item.setJsonLineSchema(mapper.readValue(jsonLineFormat.getJsonSchema(), Map.class));
|
||||||
break;
|
break;
|
||||||
case CSV:
|
case CSV:
|
||||||
CsvResourceFormat csvFormat = (CsvResourceFormat) dataResource.getFormat();
|
CsvResourceFormat csvFormat = (CsvResourceFormat) dataResource.getFormat();
|
||||||
item.setCsvSchemaText(csvFormat.getSchema());
|
item.setCsvSchemaText(csvFormat.getCsvSchema());
|
||||||
item.setCsvSchema(mapper.readValue(csvFormat.getSchema(), Map.class));
|
item.setCsvSchema(mapper.readValue(csvFormat.getCsvSchema(), Map.class));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNotNull(dataResource.getExample())) {
|
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 = ?")
|
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
||||||
public class CsvResourceFormat extends ResourceFormat {
|
public class CsvResourceFormat extends ResourceFormat {
|
||||||
private String schema;
|
private String csvSchema;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getFormatType() {
|
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 = ?")
|
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
||||||
public class JsonLineResourceFormat extends ResourceFormat {
|
public class JsonLineResourceFormat extends ResourceFormat {
|
||||||
private String schema;
|
private String jsonSchema;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getFormatType() {
|
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 = ?")
|
@SQLDelete(sql = "update " + Constants.TABLE_PREFIX + "resource_format" + " set deleted = true where id = ?")
|
||||||
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
@Where(clause = LogicDeleteIdOnlyEntity.LOGIC_DELETE_CLAUSE)
|
||||||
public class JsonResourceFormat extends ResourceFormat {
|
public class JsonResourceFormat extends ResourceFormat {
|
||||||
private String schema;
|
private String jsonSchema;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Type getFormatType() {
|
public Type getFormatType() {
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ spring:
|
|||||||
profiles:
|
profiles:
|
||||||
include: common,metrics,encrypt
|
include: common,metrics,encrypt
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:h2:./database;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE
|
url: jdbc:mysql://132.122.1.185:31000/gringotts
|
||||||
username: lanyuanxiaoyao
|
username: iap
|
||||||
password: lanyuanxiaoyao
|
password: SLvwP6@SM2J*SbUw_iap
|
||||||
driver-class-name: org.h2.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
jpa:
|
jpa:
|
||||||
generate-ddl: true
|
generate-ddl: true
|
||||||
show-sql: true
|
show-sql: true
|
||||||
|
|||||||
Reference in New Issue
Block a user