Dear Nathan,

It's working fine for my project. When running unit test, it will bring up an 
H2 DB in embedded mode and run the changelog against it. 

So for unit test, we don't need an Oracle DB available for DAOs testing, and is 
running a lot faster then using Oracle.

No major problem observe so far, except the column types I mentioned and we 
find one Hibernate Query need to be modified to have it able to run on H2.

Let me know if you need more information.

Cheers
Clarence




From: Voxland, Nathan 
Sent: Thursday, January 08, 2009 5:59 AM
To: liquibase-user@lists.sourceforge.net 
Subject: Re: [Liquibase-user] Liquibase - different column type 
fordifferentdatabase vendor


By the way, I had also been thinking of using H2 as a database to run 
unit/integration tests against rather than our "real" database to make them run 
faster.  How is it working for you?  Are they running noticeably faster?  Are 
you running into any problems and/or missed bugs?

 

Nathan

 

From: Clarence Ho [mailto:clare...@clarenceh.com] 
Sent: Wednesday, January 07, 2009 12:26 AM
To: liquibase-user@lists.sourceforge.net; Voxland, Nathan
Subject: [Liquibase-user] Liquibase - different column type for 
differentdatabase vendor

 

Hi,

 

I have a question on using Liquibase and would like to seek for advice. 

I have an application that use Oracle as the backend DB, and I created a change 
log for creating the schema. 

However, when running unit test, I will bought up an in-memory H2 database and 
run the same change log file against the DB for DAO unit testing. The objective 
is to allow the unit test to run without an Oracle DB available.

I have one problem when dealing with timestamp columns.  

In Oracle, I am using "TIMESTAMP WITH LOCAL TIME ZONE" as the column type. A 
segment of the change log was as follows: 
<createTable tableName="COUNTRY"> 
            <column name="AUDIT_CREATE_TS" type="TIMESTAMP WITH LOCAL TIME 
ZONE"> 
                <constraints nullable="false"/> 
            </column> 
</createTable> 

However, when running unit test, obvious H2 doesn't support this data type, and 
Liquibase will fail. I have to change to type="TIMESTAMP" for it to work. 

>From the manual, I understand that I can use one of the following method to 
>fulfill what I want: 
1. Create a custom database class to handle the H2 database creation 
2. Use parameter (e.g. TimestampColumnType="TIMESTAMP") and pass the parameter 
into Liquibase when run. 

However, I just thinking about it will be great if Liquibase support something 
like "variables" which can be configure by DB type. For example, in the 
changelog, I can define a variable in the preCondition (just an example I can 
think of): 
    <preConditions> 
        <or> 
            <dbms type="oracle" /> 
            <dbms type="h2" /> 
        </or> 
    </preConditions> 

   <setVariable name="timestampType"> 
         <value="TIMESTAMP WITH LOCAL TIME ZONE" dbms="oracle"/> 
         <value="TIMESTAMP" dbms="h2"/> 
   </setVariable> 

And then I can change my change log fragment to: 
<createTable tableName="COUNTRY"> 
            <column name="AUDIT_CREATE_TS" type=${timestampType}> 
                <constraints nullable="false"/> 
            </column> 
</createTable> 

In this case, then I can define the very DB specific column type that we want 
for different DB. 

I think the advantage of this approach is that it allows more consistent change 
log instead of passing different parameters when running Liquibase. 

Any advice are welcome. 

Thanks
Clarence 



--------------------------------------------------------------------------------


------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB 


--------------------------------------------------------------------------------


_______________________________________________
Liquibase-user mailing list
Liquibase-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/liquibase-user
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
Liquibase-user mailing list
Liquibase-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/liquibase-user

Reply via email to