How does flyway / liquibase handle destructive upgrades in service?

筅森魡賤 提交于 2020-01-06 12:20:38

问题


Based on my understanding about flyway/liquibase, they provide ways to perform database upgrades through the pre configured scripts (SQL queries, Java files, etc.,). But i am not very much clear about the following :

  1. What happens if there is destructive upgrade.

    I have a use case like changing an bigint column(containing data) to date type. If i try to change it directly, i will end up with corrupted data for the column. How does flyway/liquibase handle these kinds of upgrades ?

  2. Whether pre configured scripts are the only way to say flyway/liquibase that these are my changes or is there any other way for that matter. If there is some other way, will it output the diff in the form of queries ?

It will be very much helpful if someone shed light on the above.


回答1:


Speaking from Flyway's perspective, it was built with sql and java support from the start. How you migrate your db using either of these is your responsibility. Flyway will do as you tell it.




回答2:


In Liquibase you can make this work by using the SQL Formated scripts, I assume your trying to make use of the XML markup tags to avoid having to do raw SQL and running into the down fall of having the XML translate exactly what you want to do. Make life easier and use SQL scripts and leverage Liquibase.



来源:https://stackoverflow.com/questions/16721166/how-does-flyway-liquibase-handle-destructive-upgrades-in-service

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!