Removing an intersect table

Hi there,


We’re not using Liquibase yet, but we might start! :slight_smile:


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: 
  1. Add the parent_id column to the child table;
  2. Copy the parent_id values from parent_child to the parent_id column in the corresponding child row;
  3. Drop the parent_child table;
  4. 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!