I previously talked about our new Liquibase support in SQLcl, so you may want to start there if it’s brand new to you.

I shared some slides, and links to the Docs, but not much in the way of demo. I wanted to fix that today, so here’s a quick video showing off SQLcl and Liquibase.

Technically speaking, it’s 5 and a half minutes.

The Plot

I have two schemas:

  1. LB_DEV
  2. LB_UAT

I’m going to create two tables in LB_DEV, and call this first go, version 1 (v1).

Very boring, by design.

I’m going to generate a Liquibase changelog of this schema using SQLcl.

LB_DEV SQL> lb genschema

I’m going to update my UAT environment, basically ‘Install v1.’ Note, this is where the cool part comes in – in the previous step, ‘genschema’ has asked SQLcl to create the ‘controller.xml’ and all of the referenced object xml files FOR ME. And, SQLcl has ordered them such in the controller that there won’t be any dependency issues going forward.

Whiz-bang!

LB_UAT SQL> lb update controller.xml false

I’m going to do some work in Dev, add some fancy things like constraints, including a foreign key.

I’m going to see what that would like like in UAT BEFORE I upgrade it to ‘v2.’

LB_UAT SQL> lb updatesql controller.xml false

UPDATESQL says, hey, just show me the SQL you would theoretically run if you were to do an UPDATE with this controller.xml changeset.

Now, let’s actually do the update to ‘v2.’

LB_UAT SQL> lb update controller.xml false

And finally I’m going to show how you can do ‘normal Liquibase stuff’ using SQLcl, like use sqlFile to run some INSERTs to populate my base tables.

Updated Slides

Newer, and hopefully better, slides.

thatjeffsmith
Author

I'm a Master Product Manager at Oracle for Oracle SQL Developer. My mission is to help you and your company be more efficient with our database tools.

Write A Comment