我正在尝试使用我在@Entity
s中所做的更改生成一个变更集
我有以下gradle设置。我正在使用这些插件 liquibase-gradle-plugin liquibase-hibernate
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-data-rest')
compile('org.springframework.boot:spring-boot-starter-hateoas')
compile('org.springframework.boot:spring-boot-starter-jooq')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter-mail')
compile('com.github.waffle:waffle-spring-boot-starter:1.9.0')
compile('com.oracle.jdbc:ojdbc8:12.2.0.1')
runtime('org.springframework.boot:spring-boot-devtools')
compileOnly('org.projectlombok:lombok')
apt('org.projectlombok:lombok:1.18.2')
liquibaseRuntime('org.liquibase:liquibase-core:3.6.2')
liquibaseRuntime('org.liquibase:liquibase-groovy-dsl:2.0.1')
liquibaseRuntime('org.liquibase.ext:liquibase-hibernate5:3.6')
liquibaseRuntime('com.oracle.jdbc:ojdbc8:12.2.0.1')
liquibaseRuntime('org.springframework.boot:spring-boot-starter-data-jpa')
liquibaseRuntime sourceSets.main.output
providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
testCompile('org.springframework.boot:spring-boot-starter-test')
testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')
}
diff.dependsOn compileJava
diffChangeLog.dependsOn compileJava
generateChangelog.dependsOn compileJava
liquibase {
activities {
main {
changeLogFile 'main.groovy'
referenceUrl 'jdbc:oracle:thin:@localhost:1521:XE'
referenceUsername 'user'
referencePassword 'pass'
url 'hibernate:spring:com.example' +
'?dialect=org.hibernate.dialect.Oracle10gDialect' +
'&hibernate.enhanced_id=true'
}
}
runList = 'main'
}
@Entity
main.groovy
文件中。相反,该实体的现有变更集已更改。渲染所有东西完全没有用!我在做什么错了?
答案 0 :(得分:1)
Liquibase不会从@entity
生成模式,而是从变更集文件生成模式。
您必须让hibernate / jpa / else生成模式,然后使用diffChangeLog
命令。这使您可以生成变更集文件。
在代码集中与注释并行地将更改添加到更改集文件中会更容易。
答案 1 :(得分:1)
读取wiki时,应使用gradle diff
来生成变更集文件。 gradle diffChangeLog
仅用于第一个主xml。