【发布时间】:2021-08-29 23:59:23
【问题描述】:
我已经查看了 Liquibase changesets、customChange 和 contexts,但是在阅读了这几天的材料之后,我仍然没有找到可以帮助我完成我想做的事情的答案.
基本上,我有想要通过 Liquibase 运行的数据库更改脚本。这就是我所拥有的。
-
script1.sqlDROP MATERIALIZED VIEW LOG on TABLE1
-
script2.sqlDROP MATERIALIZED VIEW TABLE1
script1.sql 应该在某个DB1 上运行,而script2.sql 应该在某个DB2 上运行。 DB1 和 DB2 的数据库 URL 是:
-
DB1:'jdbc:oracle:thin:@db_host:1521:DB1' -
DB2:'jdbc:oracle:thin:@db_host:1521:DB2'
我有 ff。定义在build.gradle:
liquibase {
activities {
main {
changeLogFile "$projectDir/src/main/db/main-changelogs.xml"
url 'jdbc:oracle:thin:@db_host:1521:DB1'
username 'root'
password 'root'
}
}
}
我的变更日志定义如下:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.0.xsd
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd">
<changeSet id="1" author="bob">
<sqlFile dbms="oracle"
path="my/path/script1.sql" />
</changeSet>
<changeSet id="2" author="bob">
<sqlFile dbms="oracle"
path="my/path/script2.sql" />
</changeSet>
</databaseChangeLog>
因此我的问题是,如何在我的更新日志中切换DB1 和DB2 之间的连接?
【问题讨论】:
标签: java sql oracle gradle liquibase