We have a setup where we sometimes need our database in MSSQL, and other times in HSQL. We’d like to have one file that could run against either DB and react accordingly to the nuances of either. We have attempted to solve the problem by using preconditions to check for the database type, and when liquibase runs update against a database it works fine, but when we use updateSQL it prints the SQL queries for both changesets, causing an error when the resulting script is run later. Is this a bug or is there a different way to tell liquibase the type of database it is dealing with when using updateSQL?
Thanks,
It should be respecting the dbms attribute in updateSQL. What version of liquibase are you running?
Nathan
I’m using liquibase 3.3.2, run through maven.
I have some changesets that are ran on only one database type. Sample:
<preConditions onFail="MARK_RAN"></div>
<dbms type="hsqldb" /></div>
</preConditions></div>
…
They work just fine when liquibase runs against the database directly, but when I run updateSQL (with the properties setting “url : jdbc:sqlserver://localhost:1433;databaseName=my_db”) I am getting this in the output SQL file:
– Changeset …/ourApp/src/main/resources/changelogs/1.4.0-changelog.xml::1418685979642-17-hsql::nthorn
CREATE TABLE [Message] ( … )
GO
INSERT INTO [DATABASECHANGELOG] (… , [COMMENTS], [EXECTYPE], [LIQUIBASE]) VALUES (… , ‘createTable’, ‘’, ‘EXECUTED’, ‘3.3.2’)
GO
So it looks to me like my precondition is failing, and I’m wondering if I might just not be telling liquibase the type of database it is addressing properly.
Thanks for the help Nathan,
Nate