NOOB: Liquibase doesn't detect that it has applied the changesets

Hi,

I finally got around to adopting Liquibase yesterday and was up and running really quickly. I created two changesets for my database and was able to apply them:

 

   

   

   

   

       
           
   
   
       
   

When I run the “update” from the command line I can see that the changes have been applied to the database. The databasechangelog and databasechangeloglock tables also get created and two new entries are made in databasechangelog, as expected:

‘1.0.1.1’, ‘gc’, ‘…changelogsdb.changelog-1.0.1.xml’, ‘2010-04-19 00:11:04’, ‘208c3527f2ef7c19a8f14959e61a8f’, ‘Add Column’, ‘’, ‘1.0.1’, ‘1.9.5’
‘1.0.1.2’, ‘rbcgc’, ‘…changelogsdb.changelog-1.0.1.xml’, ‘2010-04-19 00:11:04’, ‘784f75cccea741ef521a33abfaca92aa’, ‘Update Data’, ‘’, ‘1.0.1’, ‘1.9.5’

Also there doesn’t appear to be any remaining locks:

1, 0, ‘’, ‘’

When I attempted to rollback (using rollbackCount) the changes did not rollback. The command returned and says it was successful but the changes haven’t been rolled back. Using rollbackCountSQL 10 just shows me the following - so it didn’t run the SQL I would expect to remove my newly added column and update data:

SELECT COUNT(*) FROM DATABASECHANGELOGLOCK WHERE ID=1;

– Release Database Lock
UPDATE DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE  ID = 1;

When I run the status command it says that two changes have yet to be applied:

2 change sets have not been applied to root@jdbc:mysql://localhost:3306/gc
    …\changelogs\db.changelog-1.0.1.xml::1.0.1.1::gc
    …\changelogs\db.changelog-1.0.1.xml::1.0.1.2::gc

When I run futureRollbackSQL I do the see the SQL I would expect for the rollback.

When I try to run the update again it fails because the column I am adding is already been added to the table first time round.

Anyone any ideas? Bring new I’m probably missing something really basic. Also apologies if I haven’t supplied any pertinent info.

Thanks for your time.

Environment:

Java: 1.5.0_13
Liquibase: 1.9.5
MySQL: 5.1.30-community
Driver: mysql-connector-java-5.1.10-bin.jar

I notice that your databasechangelog file lists the filename as “…changelogsdb.changelog-1.0.1.xml” and the status lists “…/changelogsdb.changelog-1.0.1.xml” as not ran.

It may be due to a bug that I fixed recently for the upcoming 2.0 release, but may exist in the 1.9 branch as well.  The filename is included in the unique identifier for each changeset, and so when they vary, liquibase thinks the changesets are different.

It looks like you are using a system path for your changesets rather than a “classpath” path.  It’s generally better to use the classpath approach because it is more flexible when it comes to cross-machine differences.  If you change your liquibase call to include your …/ folder in the classpath, and simply reference your changelogs as changelogsdb.changelog-1.0.1.xml ?

Nathan

Hi Nathan,

I used the classpath option as you suggest and that sorted things out. That’s awesome, thanks for that. Been really impressed with everything with Liquibase to date, you’ve done a great job.

Brian

Thanks.  Glad you got it working.

Nathan