Logical filepath in change-sets and changelog

Hi,

It makes me happy to say that yesterday for the first time I got a ‘create-table’ change running successfully using change-set and change-log entirely in the Clojure programming language. I am now onto optimizing the syntax for the end-user, which brings me to the topic of ‘logical-filepath’.

http://www.liquibase.org/manual/changeset
http://www.liquibase.org/manual/databasechangelog

You would notice that changeset does not mandate a ‘filepath’, but changelog optionally allows to specify a ‘filepath’. On the other hand, the API liquibase.changelog.ChangeSet and liquibase.changelog.DatabaseChangeLog both need ‘filepath’ as arguments. I presume the XML parser supplies the ‘filepath’ to ChangeSet, and similarly to DatabaseChangeLog. When I run ‘update’ on the change-log I notice only the change-set’s filepath is updated into the ‘databasechangelog’ table, and the change-log’s filepath isn’t noticed anywhere in the database.

I want to understand the relation between the filepath mentioned in change-set and filepath mentioned in change-log. What happens when change-set’s filepath does not match change-log’s filepath? What happens when I modify (after having run ‘update’ on them already once) the filepath in change-set or change-log and run update/rollback commands?

Regards,
Shantanu

Good to hear it’s working from clojure. 

The idea is that there is a physical filepath which is used for actually loading the file from the filesystem and reporting errors in the file (parse error on /x/y/z.xml line 23) and there is a logical filepath that is stored as part of the changeset’s unique identifier.  We include the filepath in the identifier so that you can have duplicate id/author combinations across files.  By default, the changeSet’s filename is the physical filepath of the changelog it is in, but that can be overriden.  The main reasons are:

  1. a changelog is moved physically, in which case you set the logicalFilePath parameter on the changelog file to be the old physical path
  2. a changeSet is moved from one file to another, in which case you set the logicalFilePath parameter on the changeSet (I don’t remember if this has actually been implemented yet or not)

The main thing, is that since the filepath is part of the changeset identifier, it needs to remain consitant or else liquibase will think it is an unrun changeset and re-run it.

Does that help?

Nathan