We used Cloud Spanner and are looking for a CD tool to automatically deploy Spanner schema change. Looks like Liquibase is the answer. From the tutorial, it seems that a changelog file is required. Does the changelog file have to be written manually?
I know Liquibase has a diff command to generate the changelog by comparing to two databases, but here is what we are looking for: We want to compare a local spanner DDL FILE (with the new schema) vs a Cloud Spanner schema (via JDBC), to generate the changelog file. Is it possible with Liquibase?
Hi there, @Bin - Welcome to the Liquibase Community!
Have you taken a look at the free Liquibase University courses? That would probably be the most helpful to you in learning to set up your Liquibase config. The Fundamentals course should only take a day or two to complete if you can devote a block of uninterrupted hours to it. Liquibase Fundamentals Certification (LB101) From there you can start on the intermediate course track - there are 4 intermediate courses - and that will really help. I’ve found them to be invaluable, personally. I hope they will be to you, too!
I don’t know if this helps you but by connecting to a database and applying the generateChangeLog command, you will automatically generate a Changelog file from that database.
But based on your need, Liquibase only supports files with xml, json, yaml and sql extensions. It would not work for the ddl file, but you can generate the changelog with the above command.
Connecting to a database and getting the changelog won’t give us the change delta to be deployed.
How about we creating a temporary Spanner database with DDL and then do a diff between this temporary Spanner database vs the real Spanner database to generate the changelog? Would that work? Does the liquibase diff command support Spanner database?
I think so, because Liquibase supports Cloud Spanner databases, and has its driver. So, the diff command has to support that type of database, but as you can see in this part of the documentation the level is “compatible” you should test if it really works.
Hey @Bin, Valen’s answer is a good one. Liquibase doesn’t support using a DDL file for diff, but using an ephemeral database to load the DDL and compare it against a live database should work for you. Let us know how it goes.
When you get a chance, could you also share your use case? It’s always interesting to hear more about the problems people are solving with Liquibase.