Developers & Practitioners

Managing schema changes on Cloud Spanner using Liquibase

We’re very happy to announce that you can now use Liquibase’s open-source database devops library to manage and automate schema changes in Cloud Spanner.  The availability of Liquibase Cloud Spanner extension beta version 1.0 brings all of Liquibase’s CI/CD benefits to Spanner.

You can find the source and detailed information in GitHub here: cloudspannerecosystem/liquibase-spanner

Supported Features

The following change types are supported by the extension: createTable, dropTable, addColumn, modifyDataType, addNotNullConstraint, dropColumn, createIndex, dropIndex, addForeignKeyConstraint, dropForeignKeyConstraint, dropAllForeignKeyConstraints, addLookupTable, insert, update, loadData, and loadUpdateData.

ChangeTypes are all tested as unit tests, with the Spanner emulator, and with a real Spanner.

Example

An example changelog.yaml is provided that demonstrates a changelog applied to Spanner. This is to help apply Liquibase Best Practices using Spanner.

It includes the following:

To get started,  create a Cloud Spanner instance in your GCP account or in a Spanner Qwiklab and try the Liquibase extension