Connect Liquibase with AlloyDB
Last updated: October 28, 2025
AlloyDB is a fully managed, PostgreSQL-compatible database service from Google Cloud that is built for demanding workloads.
Before you begin
Ensure you have Java installed. Liquibase requires Java to run. If you used the Liquibase Installer, Java is included automatically. Otherwise, you must install Java manually.
Procedure
(Maven users only) Configure Maven
If you're running Liquibase using the Maven plugin using mvn liquibase:update installing the extension with Maven ensures the right files are available and everything works together automatically. You can manage these extensions by adding them as dependencies in your project’s pom.xml file. When configured this way, Maven automatically downloads the specified JAR files from Maven Central during the build process.
Configure connection
1. Ensure your database is configured.
2. Specify the database URL in the liquibase.properties file (defaults file), along with other properties you want to set a default value for. Liquibase does not parse the URL. You can either specify the full database connection string or specify the URL using your database's standard connection format:
url: jdbc:postgresql://<host>:<port>/<dbname>
3. Set your schema. You can use the PUBLIC schema with AlloyDB, but this may lead to unexpected behavior. We recommend you create and use a custom (non-default) schema.
defaultSchemaName=mySchema
Test your connection
1. Create a text file called changelog (.sql, .yaml, .json, or .xml) in your project directory and add a changeset.
If you already created a changelog using the init project command, you can use that instead of creating a new file. When adding onto an existing changelog, be sure to only add the changeset and to not duplicate the changelog header.
--liquibase formatted sql
--changeset your.name:1
CREATE TABLE test_table (
test_id INT NOT NULL,
test_column INT,
PRIMARY KEY (test_id) NOT ENFORCED
)2. Navigate to your project folder in the CLI and run the Liquibase connect command to see whether the connection is successful.
liquibase connect
Result
####################################################
## _ _ _ _ ##
## | | (_) (_) | ##
## | | _ __ _ _ _ _| |__ __ _ ___ ___ ##
## | | | |/ _` | | | | | '_ \ / _` / __|/ _ \ ##
## | |___| | (_| | |_| | | |_) | (_| \__ \ __/ ##
## \_____/_|\__, |\__,_|_|_.__/ \__,_|___/\___| ##
## | | ##
## |_| ##
## ##
## Get documentation at docs.liquibase.com ##
## Get certified courses at learn.liquibase.com ##
## ##
####################################################
Starting Liquibase Secure at 11:59:14 using Java 25 (version 5.0.1 #22 built at 2025-10-03 17:39:59 UTC)
Liquibase Secure Version: 5.0.1
Liquibase Secure license issued to Liquibase, valid until Tue Dec 12 01:00:00 CET 2034
Success: The database '.test (PostgreSQL 16.9)' at url 'jdbc:postgresql://localhost:5432/lbcat' is accessible with the supplied credentials.
Liquibase command 'connect' was executed successfully.