简体   繁体   English

使用liquibase changelog从Hibernate 3.6.3迁移到4.3.10

[英]Migrating from Hibernate 3.6.3 to 4.3.10 using liquibase changelog

Between Hibernate 3.6.3 and 4.3.10 the naming schema of the unique key constraints have changed. 在Hibernate 3.6.3和4.3.10之间,唯一键约束的命名架构已更改。 We are using liquibase to manage our database changes. 我们正在使用liquibase来管理数据库更改。

This has required us to add hundreds of constraint changes by hand like this: 这要求我们手动添加数百个约束更改,如下所示:

<dropUniqueConstraint constraintName="attachednetworkdevicejpa_uuid_macaddress_vlan_key" tableName="attachednetworkdevicejpa"/>
<addUniqueConstraint columnNames="uuid, macaddress, vlan" constraintName="uk_2o0nn8nq8eoo40bpyyq5k9anh" deferrable="false" disabled="false" initiallyDeferred="false" tableName="attachednetworkdevicejpa"/>

I'm adopting this branch that has fallen far behind master and has tons of these new constraints that have to be added. 我采用的是这个分支,它远远落后于master分支,并且必须添加许多新约束。 Is there a better way to handle this or do these all need to be created by hand to support this migration? 是否有更好的方法来解决此问题,或者是否需要手工创建所有这些来支持此迁移?

We ended up solving this by writing a python script to scrape the base changelog and the existing code and creating a migration change between the two. 最后,我们编写了python脚本来刮除基本变更日志和现有代码,并在两者之间创建迁移更改,从而解决了这一问题。

The project can be found here: https://github.com/JLLeitschuh/Hibernate-3-to-4-Liquibase-Changelog-Gen 该项目可以在这里找到: https : //github.com/JLLeitschuh/Hibernate-3-to-4-Liquibase-Changelog-Gen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM