Home:ALL Converter>Liquibase - Generate changelog from oracle schema to migrate to postgres

Liquibase - Generate changelog from oracle schema to migrate to postgres

Ask Time:2019-03-09T02:21:27         Author:Karthik Cherala

Json Formatter

Currently I am on an oracle schema which is maintained with liquibase. The liquibase xmls have some oracle specific usage of queries for dataload and using sequences etc (also some usage specific to oracle).

I would like to move to postgres. Would it be possible to generateChangeLog from oracle schema to execute it against a postgres db (or a changelog that is completely liquibase specific so that it will automatically convert it to target database at runtime)? I do not see an option to specify target database type on generatechangelog. Is there any way to achieve that?

Author:Karthik Cherala,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/55068901/liquibase-generate-changelog-from-oracle-schema-to-migrate-to-postgres
a_horse_with_no_name :

Yes this is possible, although it's easier when you start the changelog with multiple DBMS in mind. \n\n<createSequence> changes should be fine, however if you have any explicit calls to .nextval those would need to be changed. \n\nYou can run changeSets conditionally depending on the current DBMS:\n\n<changeSet dbms=\"postgresql\">\n...\n</changeSet>\n\n\nor use dbms=\"oracle\". I think (not sure though) the DBMS attribute does not change the MD5 checksum, so you can change your existing change log without it breaking against your existing installations. \n\nHow much you need to adjust your current changelog depends on how specific you were when e.g. specifying data types, e.g. you can't use varchar2 for obvious reasons, and changing that will change the MD5 checksum which will break running the changelog against your existing installations.\n\nI would try to change the changelog you have to be as much DBMS independent as possible and then bite the bullet and run it once with clearCheckSums against existing installations. ",
2019-03-08T19:32:50
yy