Liquibase Spanner Extension
Introduction
We’re very happy to announce the availability of Liquibase Spanner extension beta version 1.0. This brings all of Liquibase’s CI/CD benefits to Spanner.
You can find the source and detailed information in GitHub here:
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:
- create-schema.yaml: Create for Singers and Albums tables, including interleaved tables, column options, and indexes.
- load-data-singers.yaml: Load data into Singers table from CSV.
- load-update-data-singers.yaml: Insert/update Singers table from CSV.
- add-lookup-table-singers-countries.yaml: Create Countries table as a foreign key from Country field in Singers.
- modify-data-type-singers-lastname.yaml: Alter datatype in Singers LastName column.
- insert.yaml: Insert rows into Singers table.
- delete.yaml: Delete rows from Singers.
- update.yaml: Update rows in Singers.
Limitations
There are a few limitations that should be considered.
Credits
Knut Løite, Andrew James (Credera UK) for the original Liquibase code, and Stefan Serban.