A new topic, 'Broken SQL rollback - now what?', has been made on a board you
are watching.
You can see it at
http://liquibase.org/forum/index.php?topic=126.new#new
The text of the topic is shown below:
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">
<changeSet author="lrc" id="1">
<addColumn tableName="IOType">
<column name="PhysicalQuantityId" type="number(19) null"
remarks="Which physical quantity this IOType measures"/>
</addColumn>
<sql>
UPDATE IOType io
SET PhysicalQuantityId = (SELECT PhysicalQuantityID FROM OC_IOType
oc_io WHERE oc_io.Id = io.IoType);
</sql>
<dropTable tableName="OC_IoType"/>
<rollback>
<createTable tableName="OC_IoType">
<column name="Id" type="number(19) not null"/>
<column name="Name" type="nvarchar(256) not null"/>
<column name="PhysicalQuantityId" type="number(19) not null"
</createTable>
<sql>
UPDATE OC_IOType oc_io
SET PhysicalQuantityId = (SELECT PhysicalQuantityID FROM IOType io
WHERE oc_io.Id = io.IoType);
</sql>
<dropColumn tableName="IOType" columnName="PhysicalQuantityId"/>
</rollback>
</changeSet>
</databaseChangeLog>
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
Unsubscribe to new topics from this board by clicking here:
http://liquibase.org/forum/index.php?action=notifyboard;board=1.0
Regards,
The LiquiBase Community Forum Team.------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Liquibase-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/liquibase-user