views:

715

answers:

1

Following the quickstart on liquibase i've created a changeset (very dumb :) )

Code:

<?xml version="1.0" encoding="UTF-8"?>

<databaseChangeLog
  xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.6"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.6
         http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.6.xsd"&gt;

    <changeSet id="1" author="me">
        <createTable tableName="first_table">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
            <column name="name" type="varchar(50)">
                <constraints nullable="false"/>
            </column>
        </createTable>
        <createTable tableName="new_table">
            <column name="id" type="int">
                <constraints primaryKey="true" nullable="false"/>
            </column>
        </createTable>
    </changeSet>

</databaseChangeLog>

I've created a clean schema and i've launched the migrate command.

Liquibase created the database, with the support tables databasechangelog and ..lock.

Now how i can track the changes?? i've modified the changeset adding a new createTable element but when i try the command "update" liquibase tells me this

Migration Failed: Validation Failed:
     1 change sets check sum

so i don't think to have understood the way to work with liquibase.

Someone may point me to the right direction??

Thanks

+4  A: 

You should never modify <changeSet> that was already executed. Liquibase calculates checksums for all executed changeSets and stores them in the log. It will then recalculate that checksum, compare it to stored and fail next time you run it if the checksums differ.

What you need to do instead is add another <changeSet> and put your new createTable element in it.

QuickStart is good readin' but it is indeed quick :-) Check out full manual, particularly its ChangeSet section.

ChssPly76
that's clear now, i didn't found and read that page in the manual :)
avastreg