A little more info/revision:
I see now that the entire changelog.xml is *not* being performed. It
does, indeed, bail out on the first failure. I just don't understand
why, I guess. Here is the specific change set that is failing:
<changeSet author="dhicks (generated)" id="1224863298725-24">
<createIndex indexName="K_code" tableName="product_type"
unique="false">
<column name="code" />
</createIndex>
</changeSet>
It complains that this index already exists, but I don't see where it
would have been created previously. In fact, outside of some "insert"
statements to create data, here is the only other mention of that table:
<changeSet author="dhicks (generated)" id="1224863298725-11">
<createTable tableName="product_type">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints nullable="false" primaryKey="true" />
</column>
<column name="version" type="BIGINT">
<constraints nullable="false" />
</column>
<column defaultValue="" name="code" type="varchar(255)">
<constraints nullable="false" />
</column>
<column defaultValue="" name="name" type="varchar(255)">
<constraints nullable="false" />
</column>
</createTable>
</changeSet>
You can see, by the ID, that this changeset would come before the
previous one.
David C. Hicks wrote:
> Hi guys,
>
> I've been trying to get Liquibase to run our changelog.xml using the
> API. I found a piece of code that Nathan had made available to
> someone at a previous time. It seems to work, mostly, but I get a
> SQLException at the end of it all. Here's a code excerpt:
>
> private void doLiquibaseUpdate() throws Exception {
> FileOpener fileOpener = new FileSystemFileOpener();
> DatabaseFactory databaseFactory =
> DatabaseFactory.getInstance();
> Database database = null;
> database =
> databaseFactory.findCorrectDatabaseImplementation(getConnection());
> Liquibase liquibase = new Liquibase(databaseChangeLogFile,
> fileOpener, database);
> liquibase.update("");
> }
>
> As I mentioned, everything seems to work correctly, up to the end. I
> get log messages indicating that each change set gets applied. At the
> end of it all, though, a SQLException is thrown from
> liquibase.update("") indicating that an attempt to create an index
> that already exists has occurred. I've searched through our
> changeLog.xml and I don't see any duplication of that particular index.
>
> My goal is to use this in a unit test base class to set up an
> in-memory HSQLDB database during the onSetUp() phase of an
> AbstractTransactionalDataSourceSpringContextTests test case. The idea
> being that it's a nice way to set up a database for testing DAO
> methods. [I'm not interested in a religious war about how to test DAO
> methods.]
>
> Normally, I apply our changeLog.xml using either
> maven-liquibase-plugin, or the command line tools. So, the
> differences are: a) using the API, b) using HSQLDB instead of MySQL.
> I just don't know of any good way to "debug" what's happening on the
> inside of that call to try to track this down.
>
> Any thoughts?
> Thanks,
> Dave
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> ------------------------------------------------------------------------
>
> _______________________________________________
> Liquibase-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/liquibase-user
>
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Liquibase-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/liquibase-user