Database type differences

hi,
i’m using liquibase to create a diff of 2 postgres databases and generating a changelog.xml.
next step is to use this diff file to upgrade an existing oracle database instance to the desired state.
oracle and postgres are using different data types in some cases, so the import is going to fail with the generated postgres changelog.
i would like to specify something like typedef for database oracle and set eg.: in value “bigint” to output type “number”.
there is an old ticket showing that this should be implemented in liquibase:
https://liquibase.jira.com/browse/CORE-422
but i didn’t found the typedef in the liquibase xsd and it’s not working :wink:

question: am i missing something or using liquibase wrong and is there an option to use the typedef?
another option would be to replace the types in the changelog file before importing, but I would like to avoid that …

thx, br
jmu

Hi @jmu,

Welcome to the forum group, thanks for joining!

To answer your question, let me make sure I am understanding you properly, you want to be able to change certain keywords in a generated changelog that will make it compatible with the new target to be updated right?

As CORE-422 suggests, you can do token replacement and mapping using properties and tags (labels).
https://docs.liquibase.com/concepts/basic/changelog-parameters.html
https://docs.liquibase.com/concepts/advanced/labels.html

This is preferred to updating the xsd.

Does that help?

Ronak

Hi Ronak,

thanks for your reply … - to be honest - I’m not really sure :wink: - probably a short example helps:

diff between two postgres databases produces a changelog file containing:

<changeSet author="xy (generated)" id="1591082717861-15">
<modifyDataType columnName="VERSION" newDataType="BIGINT" tableName=DATA_TYPES"/>
</changeSet>


now i’d like to use this changelog file to update an existing postgresql database, but some types are not existing. So it is necessary to replace the value of newDataType=“BIGINT” to a valid postgresql datatype of “number19”, like:

<modifyDataType columnName="VERSION" newDataType="number(19)" tableName=DATA_TYPES"/>

so, if there is a possibility to add something like a type match - if dmbs=“oracle” then datatype BIGINT is modified to NUMBER, it would be possible to specify the datatypes and use the same changelog file for different dmbs eg. oracle and postgres.

Hope this clarifies my question :slight_smile:
BR
JMU