![](/img/trans.png)
[英]How can I configure Maven Liquibase plugin in Spring Boot?
[英]How to introduce liquibase in midle of spring boot maven based project
`我已經在運行項目並嘗試在項目中間引入 liquibase。 這是基於 spring 引導 maven 的項目。
我正在遵循步驟。
1.liquibase.properties
url=jdbc:postgresql://localhost:5432/cc
username=postgres
password=deadline123
driver=org.postgresql.Driver
outputChangeLogFile=src/main/resources/db/changelog/db.changelog-master.yaml
runOnChange=true
referenceUrl=jdbc:postgresql://localhost:5432/cc
referenceUsername=postgres
referencePassword=deadline123
changelogFile=src/main/resources/db/changelog/db.changelog-master.yaml
diffChangeLogFile=src/main/resources/diff.yaml
mvn liquibase:generateChangeLog
生成更改日志mvn liquibase:changelogSync
中創建條目 Liquibase 不會將更改與您的實際表進行比較,它只會跟蹤已經執行的更改集(它會為名為databasechangelog
的表創建另一個表)。
話雖如此,您必須確保 liquibase 執行您的變更集,前提條件是“如果有任何失敗,請將其標記為已執行”。 可以這樣實現:
<preconditions onFail="MARK_RAN">
<not>
<tableExists tableName="person"/>
</not>
</preconditions>
此示例以及更多信息可以在https://www.liquibase.com/blog/adding-liquibase-on-an-existing-project上找到
問題出在文件路徑src/main/resources/db/changelog/db.changelog-master.yaml
liquibase:changelogSync
在日志同步中添加文件路徑,並且liquibae
在啟動時實際上采用classpath
classpath:/db/changelog/db.changelog-master.yaml
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.