生产数据库上的 JHipster 项目 clearCheckSums

JHipster Project clearCheckSums on production database

在生产服务器上部署 JHipster 项目后,我使用以前的 .jhipster/*.json 文件重新生成了项目。 因此,liquibase 变更日志文件也已被重写。我通过添加字段更改了新生成的项目中的单个实体。我希望使用生产系统以前的数据库。

为了对此进行测试,我提取了生产数据库的转储并将其导入到我的本地 Postgres 安装中。在 IntelliJ 中,我 select 生产配置文件(配置为使用 PSQL 而不是 H2)。

使用生产配置文件构建应用程序时,我当然遇到了 liquibase.exception.ValidationFailedException,因为校验和已关闭。

因此,我想使用 liquibase:clearCheckSums 目标重新生成校验和。但是,目标仅在 H2 上执行。

[INFO]     driver: org.h2.Driver
[INFO]     url: jdbc:h2:file:./target/h2db/db/test
[INFO]     username: test
[INFO]     password: ****
[INFO]     use empty password: false
[INFO]     properties file: null
[INFO]     properties file will override? false
[INFO]     prompt on non-local database? true
[INFO]     clear checksums? false

尽管我需要在生产数据库 (Postgres) 上重置校验和。

我需要做什么才能改为在 Postgres 上执行?

可以在项目的pom.xml文件中编辑liquibase-maven-plugin

 <configuration>
 <changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
        <driver>[your postgres driver]</driver>
        <url>[url to your db]</url>
        <username>[your username]</username>
        <password>[your password]</password> 
 </configuration>

之后,您可以从命令行 运行 mvn libquibase 插件,如下所示: mvn liquibase:clearCheckSums 现在 liquibase 应该适用于您的数据库。 干杯,duderoot