为了账号安全,请及时绑定邮箱和手机立即绑定

LiquiBase diff & diffChangeLog 不检测变化

LiquiBase diff & diffChangeLog 不检测变化

HUWWW 2021-10-17 11:00:12
我正在尝试使用我在@Entitys 中所做的更改生成一个变更集我有以下gradle设置。我正在使用这些插件 liquibase-gradle-plugin liquibase-hibernatedependencies {    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 compileJavadiffChangeLog.dependsOn compileJavagenerateChangelog.dependsOn compileJavaliquibase {  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'}脚步.\gradlew diffChangeLog.\gradlew 更新观察初始数据库是否已正确创建观察 DATABASECHANGELOG 表已正确填充将属性添加到 @Entity.\gradlew diffChangeLog请注意,没有向main.groovy文件添加新的变更集。相反,实体的现有变更集已被更改。渲染一切完全没用!我究竟做错了什么?
查看完整描述

2 回答

?
胡子哥哥

TA贡献1825条经验 获得超6个赞

阅读您应该用来生成变更集文件的wikigradle diff。使用gradle diffChangeLog只为第一主XML。


查看完整回答
反对 回复 2021-10-17
?
温温酱

TA贡献1752条经验 获得超4个赞

Liquibase 不是@entity从变更集文件生成架构,而是从变更集文件生成架构。

您必须让 hibernate/jpa/else 生成模式,然后使用diffChangeLog命令。这允许您生成变更集文件。

在代码中添加注释的同时,在变更集文件中添加修改可能会更容易。


查看完整回答
反对 回复 2021-10-17
  • 2 回答
  • 0 关注
  • 293 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信