Hi Liquibasers!
We just changed over to LiquiBase for our development, and predictably my first change failed in an interesting manner. I know now to review the SQL before running it, even on a test DB, but I have a couple questions.
Here is my changelog entry. I am essentially moving a column from one table to another, then dropping the old table.
<?xml version="1.0" encoding="UTF-8"?><databaseChangeLog
xmlns=“http://www.liquibase.org/xml/ns/dbchangelog/1.9”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd”>
<column name=“PhysicalQuantityId” type=“number(19) null”
remarks=“Which physical quantity this IOType measures”/>
UPDATE IOType io
SET PhysicalQuantityId = (SELECT PhysicalQuantityID FROM OC_IOType oc_io WHERE oc_io.Id = io.IoType);
<column name=“PhysicalQuantityId” type=“number(19) not null”
UPDATE OC_IOType oc_io
SET PhysicalQuantityId = (SELECT PhysicalQuantityID FROM IOType io WHERE oc_io.Id = io.IoType);
The update ran fine, but when I tried to rollback, I got
liquibase.exception.RollbackFailedException: liquibase.exception.RollbackImpossibleException: No inverse to liquibase.change.SQLFileChange created
I don’t see anything in the manual about special rollback handling for SQL changes, not any examples of how to do it. I expected the SQL in the rollback would have done it. How should such a rollback really be done? Even dividing it into several changeSets does not appear to help.
Now I have a database with an un-rollbackable changeset applied. Obviously, it’d be bad to give that to everybody else, so I need to either recreate my database (which would be a lot of work, as it is also a copy of a production database for scaling tests) or manually rollback the change. The change itself would be easy enough to rollback, but how do I convince LiquiBase that I have rolled it back?
Am I right to think that if a change has been (successfully) rolled back, I can remove the change file in order to not have it applied again?
On another note, I was confused for a while trying to find the actual refactorings in the manual until I found out that they only show up at the bottom of the front page of the manual, not in the menu on the right. Is that a limitation of the Wiki or something else?
Thanks in advance,
-Lars Clausen