Auto-Increment vs. Sequences: Using Liquibase with Oracle AND MySQL

Hello everybody,

I am looking for a way to maintain a constantly evolving DB-schema for MySQL and Oracle.

Our MySQL-schema uses AUTO INCREMENTs to generate primary keys.
Our Oracle-schema uses SEQUENCES to generate primary keys.

I am unsure whether it is possible to implement these approaches in a single Liquibase-Schema

Thanks
Jens

The best approach is to use changelog parameters and the dbms tag. 

At the top of your changeset you can include:
   
    <property name=“autoIncrement” value="false dbms=“oracle”/>

Then you can have changeSets like this:

                        ....    

Liquibase will not cause changesets that define columns as auto-increment where the database does not support it, but the above is probably safer and more readable.

Nathan

Edit: Nathans idea works well for DDL statements. Currently I am stuck with CSV imports.

Nathan,

thank you very much. Your suggestion looks elegant - I like that - and I’ll test-balloon it by migrating a database from oracle to mysql and vice versa.

Jens