且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用JHipster将新字段添加到现有实体

更新时间:2023-11-30 19:53:16

这是正常现象(至少在beta中是这样),因为更新操作更改了创建实体的Liquibase迁移文件20161022122700_added_entity_Libro.xml,因此Liquibase会比较更新后的校验和文件,其中包含在更新之前首次运行迁移时在数据库中记录的校验和.

It's normal (at least in beta) because the update operation changed the Liquibase migration file 20161022122700_added_entity_Libro.xml that created the entity, so Liquibase compares the checksum of the updated file with the checksum that was recorded in your database when migration was first run before update.

因此,您有以下选择:

  • 创建一个新的迁移文件,仅添加新列(请参见 addColumn文档),使用git将创建迁移恢复为其原始内容,运行您的应用以将更改应用于数据库.这就是您的应用在生产中时要执行的操作.
  • 在数据库的databasechangelog表中手动清除校验和
  • 对您的数据库
  • 运行mvn liquibase:clearCheckSums命令.确保您的pom.xml包含用于访问数据库的maven-liquibase-plugin的正确配置.
  • 在内存中将H2用作开发数据库
  • create a new migration file to add only the new column (see addColumn documentation), revert the creation migration to its original content using git, run your app to apply changes to your database. This is what you would do when your app is in production.
  • clear the checksums by hand in databasechangelog table of your database(s)
  • run mvn liquibase:clearCheckSums command against your database(s). Make sure your pom.xml includes correct configuration for maven-liquibase-plugin to access your db.
  • use H2 in memory as dev database

由于此功能是测试版,因此可能会解决此问题.

As this feature is beta, this issue is probably going to be addressed.