Hi there,
We’re not using Liquibase yet, but we might start!
We recently had trouble with a database schema change in which we removed a redundant intersect table. Before, the structure was something like this:
child | |
---|---|
id | id |
parent_id |
So what we want to do in our migration process is:
- Add the parent_id column to the child table;
- Copy the parent_id values from parent_child to the parent_id column in the corresponding child row;
- Drop the parent_child table;
- Add the foreign key constraint to the child table.
Presumably this is a common pattern; is it directly supported by Liquibase, or is there a standard approach to making this kind of change? Of course, ideally we want to be able to script the change in both directions, i.e. forward and rollback. I know that very few RDBMS’s offer transactional DDL, but in this case, since all data of value is copied before dropping the table, it should be reversible.
Thanks!
-