I have an existing table with data in it.
foobar_table
foo
bar
baz
I want to split the baz column out of the foobar_table table and create a new table called baz_table that contains it. After the operation is done I would have the following structure with each column containing the data it had before the operation started:
foobar_table
foo
bar
baz_table
baz
How can I do this with Liquibase?
P.S. Using Liquibase via the Grails Database Migration plugin. The grailsChange tag gives me hope, but lack of example documentation leave me wanting.
Update:
I wasn’t aware of the sql that can be used in change sets. I found out about it in the example here and I think it is what I needed.
As you already found out, you can run arbitary SQL queries as a part of changeset. I go over common caveats in my blog post.
So for your example: