Using Liquibase with Cosmos DB
Azure Cosmos DB is a multi-model NoSQL database developed by Microsoft. For more information, see Azure Cosmos DB Documentation and Azure Cosmos DB: REST API Reference.
Note
This database is supported at or below the Contributed level. Functionality may be limited. Databases at the Contributed level are not supported by the Liquibase support team. Best-effort support is provided through our community forums.
For more information about the verification levels, see Database Verification and Support
Supported database versions
- 4.35.1
Prerequisites
- Introduction to Liquibase – Dive into Liquibase concepts.
- Install Liquibase – Download Liquibase on your machine.
- How to Apply Your Liquibase Pro License Key – If you use Liquibase Pro, activate your license.
To access Cosmos DB, do one of the following:
- Install the Azure Cosmos DB Emulator locally, and export the Azure Cosmos DB Emulator TLS/SSL certificate for use with Liquibase
- Create an Azure account with a subscription
- Use Cosmos DB without an Azure subscription
Install drivers
All Users
List of JARs
To use Liquibase and Cosmos DB, you need several JAR files:
- Liquibase extension for Cosmos DB:
liquibase-cosmosdb-4.20.0.jar
- Azure Core:
azure-core-1.37.0.jar
- Azure Cosmos:
azure-cosmos-4.41.0.jar
- Dropwizard Metrics:
metrics-core-4.2.17.jar
- Jackson Annotations:
jackson-annotations-2.14.2.jar
- Jackson Core:
jackson-core-2.14.2.jar
- Jackson Databind:
jackson-databind-2.14.2.jar
- Jackson Datatype:
jackson-datatype-jsr310-2.14.2.jar
- Jackson Afterburner:
jackson-module-afterburner-2.14.2.jar
- Micrometer Core:
micrometer-core-1.10.5.jar
- Micrometer Observation:
micrometer-observation-1.10.5.jar
- Netty Buffer:
netty-buffer-4.1.90.Final.jar
- Netty Codec:
netty-codec-4.1.90.Final.jar
- Netty Codec DNS:
netty-codec-dns-4.1.90.Final.jar
- Netty Codec HTTP:
netty-codec-http-4.1.90.Final.jar
- Netty Codec HTTP2:
netty-codec-http2-4.1.90.Final.jar
- Netty Codec Socks:
netty-codec-socks-4.1.90.Final.jar
- Netty Common:
netty-common-4.1.90.Final.jar
- Netty Handler:
netty-handler-4.1.90.Final.jar
- Netty Handler Proxy:
netty-handler-proxy-4.1.90.Final.jar
- Netty Resolver:
netty-resolver-4.1.90.Final.jar
- Netty Resolver DNS:
netty-resolver-dns-4.1.90.Final.jar
- Netty TC Native:
netty-tcnative-2.0.59.Final.jar
- Netty TC Native SSL:
netty-tcnative-boringssl-static-2.0.59.Final.jar
- Netty TC Classes:
netty-tcnative-classes-2.0.59.Final.jar
- Netty Transport:
netty-transport-4.1.90.Final.jar
- Netty Transport Classes Epoll:
netty-transport-classes-epoll-4.1.90.Final.jar
- Netty Transport Classes Kqueue:
netty-transport-classes-kqueue-4.1.90.Final.jar
- Netty Transport Native Epoll:
netty-transport-native-epoll-4.1.90.Final-linux-x86_64.jar
- Netty Transport Native Kqueue:
netty-transport-native-kqueue-4.1.90.Final.jar
- Netty Transport UNIX:
netty-transport-native-unix-common-4.1.90.Final.jar
- Reactive Streams:
reactive-streams-1.0.4.jar
- Reactor Core:
reactor-core-3.5.4.jar
- Reactor Netty:
reactor-netty-1.1.5.jar
- Reactor Netty Core:
reactor-netty-core-1.1.5.jar
- Reactor Netty HTTP:
reactor-netty-http-1.1.5.jar
- SLF4J:
slf4j-api-2.0.6.jar
- SLF4J Simple:
slf4j-simple-2.0.6.jar
get_dependencies.bat
You can use this BAT script to download the files quickly:
setlocal
SET LIQUIBASE_COSMOSDB="4.29.1"
SET AZURE_COSMOS_VERSION="4.41.0"
SET AZURE_CORE_VERSION="1.37.0"
SET JACKSON_CORE="2.14.2"
SET SLF4J_API="2.0.6"
SET NETTY_BUFFER="4.1.90"
SET REACTOR_CORE="3.5.3"
SET REACTIVE_STREAMS="1.0.4"
SET JACKSON_DATABIND="2.14.2"
SET JACKSON_ANNOTATIONS="2.14.2"
SET JACKSON_MODULE_AFTERBURNER="2.14.2"
SET REACTOR_NETTY="1.1.4"
SET REACTOR_NETTY_CORE="1.1.4"
SET NETTY_RESOLVER="4.1.90"
SET REACTOR_NETTY_HTTP="1.1.4"
SET NETTY_TRANSPORT="4.1.90"
SET NETTY_TCNATIVE_BORINGSSL_STATIC="2.0.59"
SET NETTY_RESOLVER_DNS="4.1.90"
SET NETTY_HANDLER_PROXY="4.1.90"
SET NETTY_HANDLER="4.1.90"
SET NETTY_COMMON="4.1.90"
SET NETTY_CODEC_SOCKS="4.1.90"
SET NETTY_CODEC_HTTP="4.1.90"
SET NETTY_CODEC_HTTP2="4.1.90"
SET NETTY_CODEC_DNS="4.1.90"
SET NETTY_CODEC="4.1.90"
SET MICROMETER_CORE="1.10.4"
SET METRICS_CORE="4.2.17"
SET LATENCYUTILS="2.0.3"
SET JACKSON_DATATYPE_JSR310="2.14.2"
SET NETTY_TCNATIVE_CLASSES="2.0.59"
SET NETTY_TRANSPORT_CLASSES_KQUEUE="4.1.90"
SET SLF4J_SIMPLE="2.0.6"
SET MICROMETER_OBSERVATION="1.10.5"
SET MICROMETER_COMMONS="1.10.5"
curl -L https://repo1.maven.org/maven2/com/azure/azure-cosmos/%AZURE_COSMOS_VERSION%/azure-cosmos-%AZURE_COSMOS_VERSION%.jar --output azure-cosmos-%AZURE_COSMOS_VERSION%.jar
curl -L https://repo1.maven.org/maven2/com/azure/azure-core/%AZURE_CORE_VERSION%/azure-core-%AZURE_CORE_VERSION%.jar --output azure-core-%AZURE_CORE_VERSION%.jar
curl -L https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/%JACKSON_CORE%/jackson-core-%JACKSON_CORE%.jar --output jackson-core-%JACKSON_CORE%.jar
curl -L https://repo1.maven.org/maven2/org/slf4j/slf4j-api/%SLF4J_API%/slf4j-api-%SLF4J_API%.jar --output slf4j-api-%SLF4J_API%.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-buffer/%NETTY_BUFFER%.Final/netty-buffer-%NETTY_BUFFER%.Final.jar --output netty-buffer-%NETTY_BUFFER%.Final.jar
curl -L https://repo1.maven.org/maven2/io/projectreactor/reactor-core/%REACTOR_CORE%/reactor-core-%REACTOR_CORE%.jar --output reactor-core-%REACTOR_CORE%.jar
curl -L https://repo1.maven.org/maven2/io/projectreactor/netty/reactor-netty-core/%REACTOR_NETTY_CORE%/reactor-netty-core-%REACTOR_NETTY_CORE%.jar --output reactor-netty-core-%REACTOR_NETTY_CORE%.jar
curl -L https://repo1.maven.org/maven2/io/projectreactor/netty/reactor-netty-http/%REACTOR_NETTY_HTTP%/reactor-netty-http-%REACTOR_NETTY_HTTP%.jar --output reactor-netty-http-%REACTOR_NETTY_HTTP%.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-resolver/%NETTY_RESOLVER%.Final/netty-resolver-%NETTY_RESOLVER%.Final.jar --output netty-resolver-%NETTY_RESOLVER%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-transport/%NETTY_TRANSPORT%.Final/netty-transport-%NETTY_TRANSPORT%.Final.jar --output netty-transport-%NETTY_TRANSPORT%.Final.jar
curl -L https://repo1.maven.org/maven2/org/reactivestreams/reactive-streams/%REACTIVE_STREAMS%/reactive-streams-%REACTIVE_STREAMS%.jar --output reactive-streams-%REACTIVE_STREAMS%.jar
curl -L https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/%JACKSON_DATABIND%/jackson-databind-%JACKSON_DATABIND%.jar --output jackson-databind-%JACKSON_DATABIND%.jar
curl -L https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/%JACKSON_ANNOTATIONS%/jackson-annotations-%JACKSON_ANNOTATIONS%.jar --output jackson-annotations-%JACKSON_ANNOTATIONS%.jar
curl -L https://repo1.maven.org/maven2/com/fasterxml/jackson/module/jackson-module-afterburner/%JACKSON_MODULE_AFTERBURNER%/jackson-module-afterburner-%JACKSON_MODULE_AFTERBURNER%.jar --output jackson-module-afterburner-%JACKSON_MODULE_AFTERBURNER%.jar
curl -L https://repo1.maven.org/maven2/io/projectreactor/netty/reactor-netty/%REACTOR_NETTY%/reactor-netty-%REACTOR_NETTY%.jar --output reactor-netty-%REACTOR_NETTY%.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-resolver/%NETTY_RESOLVER%.Final/netty-resolver-%NETTY_RESOLVER%.Final.jar --output netty-resolver-%NETTY_RESOLVER%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-transport-native-unix-common/%NETTY_TRANSPORT%.Final/netty-transport-native-unix-common-%NETTY_TRANSPORT%.Final.jar --output netty-transport-native-unix-common-%NETTY_TRANSPORT%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-transport-native-epoll/%NETTY_TRANSPORT%.Final/netty-transport-native-epoll-%NETTY_TRANSPORT%.Final-linux-x86_64.jar --output netty-transport-native-epoll-%NETTY_TRANSPORT%.Final-linux-x86_64.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-tcnative-boringssl-static/%NETTY_TCNATIVE_BORINGSSL_STATIC%.Final/netty-tcnative-boringssl-static-%NETTY_TCNATIVE_BORINGSSL_STATIC%.Final.jar --output netty-tcnative-boringssl-static-%NETTY_TCNATIVE_BORINGSSL_STATIC%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-resolver-dns/%NETTY_RESOLVER_DNS%.Final/netty-resolver-dns-%NETTY_RESOLVER_DNS%.Final.jar --output netty-resolver-dns-%NETTY_RESOLVER_DNS%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-handler-proxy/%NETTY_HANDLER_PROXY%.Final/netty-handler-proxy-%NETTY_HANDLER_PROXY%.Final.jar --output netty-handler-proxy-%NETTY_HANDLER_PROXY%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-handler/%NETTY_HANDLER%.Final/netty-handler-%NETTY_HANDLER%.Final.jar --output netty-handler-%NETTY_HANDLER%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-common/%NETTY_COMMON%.Final/netty-common-%NETTY_COMMON%.Final.jar --output netty-common-%NETTY_COMMON%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-codec-socks/%NETTY_CODEC_SOCKS%.Final/netty-codec-socks-%NETTY_CODEC_SOCKS%.Final.jar --output netty-codec-socks-%NETTY_CODEC_SOCKS%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-codec-http/%NETTY_CODEC_HTTP%.Final/netty-codec-http-%NETTY_CODEC_HTTP%.Final.jar --output netty-codec-http-%NETTY_CODEC_HTTP%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-codec-http2/%NETTY_CODEC_HTTP2%.Final/netty-codec-http2-%NETTY_CODEC_HTTP2%.Final.jar --output netty-codec-http2-%NETTY_CODEC_HTTP2%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-codec-dns/%NETTY_CODEC_DNS%.Final/netty-codec-dns-%NETTY_CODEC_DNS%.Final.jar --output netty-codec-dns-%NETTY_CODEC_DNS%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-codec/%NETTY_CODEC%.Final/netty-codec-%NETTY_CODEC%.Final.jar --output netty-codec-%NETTY_CODEC%.Final.jar
curl -L https://repo1.maven.org/maven2/io/micrometer/micrometer-core/%MICROMETER_CORE%/micrometer-core-%MICROMETER_CORE%.jar --output micrometer-core-%MICROMETER_CORE%.jar
curl -L https://repo1.maven.org/maven2/io/dropwizard/metrics/metrics-core/%METRICS_CORE%/metrics-core-%METRICS_CORE%.jar --output metrics-core-%METRICS_CORE%.jar
curl -L https://repo1.maven.org/maven2/org/latencyutils/LatencyUtils/%LATENCYUTILS%/LatencyUtils-%LATENCYUTILS%.jar --output LatencyUtils-%LATENCYUTILS%.jar
curl -L https://repo1.maven.org/maven2/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/%JACKSON_DATATYPE_JSR310%/jackson-datatype-jsr310-%JACKSON_DATATYPE_JSR310%.jar --output jackson-datatype-jsr310-%JACKSON_DATATYPE_JSR310%.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-tcnative-classes/%NETTY_TCNATIVE_CLASSES%.Final/netty-tcnative-classes-%NETTY_TCNATIVE_CLASSES%.Final.jar --output netty-tcnative-classes-%NETTY_TCNATIVE_CLASSES%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-transport-classes-kqueue/%NETTY_TRANSPORT_CLASSES_KQUEUE%.Final/netty-transport-classes-kqueue-%NETTY_TRANSPORT_CLASSES_KQUEUE%.Final.jar --output netty-transport-classes-kqueue-%NETTY_TRANSPORT_CLASSES_KQUEUE%.Final.jar
curl -L https://repo1.maven.org/maven2/org/slf4j/slf4j-simple/%SLF4J_SIMPLE%/slf4j-simple-%SLF4J_SIMPLE%.jar --output slf4j-simple-%SLF4J_SIMPLE%.jar
curl -L https://github.com/liquibase/liquibase-cosmosdb/releases/download/liquibase-cosmosdb-%LIQUIBASE_COSMOSDB%/liquibase-cosmosdb-%LIQUIBASE_COSMOSDB%.jar --output liquibase-cosmosdb-%LIQUIBASE_COSMOSDB%.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-transport-classes-epoll/%NETTY_TRANSPORT%.Final/netty-transport-classes-epoll-%NETTY_TRANSPORT%.Final.jar --output netty-transport-classes-epoll-%NETTY_TRANSPORT%.Final.jar
curl -L https://repo1.maven.org/maven2/io/netty/netty-transport-native-kqueue/%NETTY_TRANSPORT%.Final/netty-transport-native-kqueue-%NETTY_TRANSPORT%.Final.jar --output netty-transport-native-kqueue-%NETTY_TRANSPORT%.Final.jar
curl -L https://repo1.maven.org/maven2/io/micrometer/micrometer-observation/%MICROMETER_OBSERVATION%/micrometer-observation-%MICROMETER_OBSERVATION%.jar --output micrometer-observation-%MICROMETER_OBSERVATION%.jar
curl -L https://repo1.maven.org/maven2/io/micrometer/micrometer-commons/%MICROMETER_COMMONS%/micrometer-commons-%MICROMETER_COMMONS%.jar --output micrometer-commons-%MICROMETER_COMMONS%.jar
endlocal
Place your JAR file(s) in the liquibase/lib
directory.
Maven Users (additional step)
If you use Maven, you must include the driver JAR as a dependency in your pom.xml
file.
Maven pom.xml file
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-cosmosdb</artifactId>
<version>4.29.1</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.37.0</version>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos</artifactId>
<version>4.41.0</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>4.2.17</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-afterburner</artifactId>
<version>2.14.2</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.10.5</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-observation</artifactId>
<version>1.10.5</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-dns</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-socks</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler-proxy</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>2.0.59.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.59.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-classes-epoll</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-classes-kqueue</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
<version>4.1.90.Final</version>
</dependency>
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.5.4</version>
</dependency>
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty-core</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>io.projectreactor.netty</groupId>
<artifactId>reactor-netty-http</artifactId>
<version>1.1.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.6</version>
</dependency>
Database connection
Configure connection
-
Ensure your Cosmos DB database is configured. See Quickstart: Build a Java app to manage Azure Cosmos DB SQL API data for more information.
-
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 JDBC format:Connection String Examples
Syntax
cosmosdb://<cosmosdb-account-name>.documents.azure.com:<AccountKey>@<cosmosdb-account-name>.documents.azure.com:<port>/<database>
Example
url: cosmosdb://amalik.documents.azure.com:Pza0RV29y...CDbOjTZjg==@amalik.documents.azure.com:443/SampleDB
Replace
<cosmosdb-account-name>
with the name you chose for your Azure Cosmos DB. Replace<accountKey>
with your private account key.For more information, see Tutorial: Connect to an Azure Cosmos account using an Azure Private Endpoint.
Syntax
cosmosdb://AccountEndpoint=https://<cosmosdb-account-name>.documents.azure.com:443;AccountKey=<accountKey>;
Example
url: cosmosdb://AccountEndpoint=https://localhost:8081/;AccountKey=C2y6yDjf5/R...IZnqyMsEcaGQy67XIw/Jw==;
This example shows the default account key, formatted for readability. For more information, see Install and use the Azure Cosmos DB Emulator for local development and testing.
For more information, see GitHub: liquibase-cosmosdb § Adjust connection string.
-
(optional) Enable Liquibase Pro capabilities
To apply a Liquibase Pro key to your project, add the following property to the Liquibase properties file:
liquibase.licenseKey: <paste key here>
Test connection
-
Create a text file called changelog (
.xml
,.sql
,.json
, or.yaml
) 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 my_name:1 CREATE TABLE test_table ( test_id INT, test_column INT, PRIMARY KEY (test_id) )
<?xml version="1.0" encoding="UTF-8"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd"> <changeSet id="1" author="my_name"> <createTable tableName="test_table"> <column name="test_id" type="int"> <constraints primaryKey="true"/> </column> <column name="test_column" type="INT"/> </createTable> </changeSet> </databaseChangeLog>
databaseChangeLog: - changeSet: id: 1 author: my_name changes: - createTable: tableName: test_table columns: - column: name: test_column type: INT constraints: primaryKey: true nullable: false
{ "databaseChangeLog": [ { "changeSet": { "id": "1", "author": "my_name", "changes": [ { "createTable": { "tableName": "test_table", "columns": [ { "column": { "name": "test_column", "type": "INT", "constraints": { "primaryKey": true, "nullable": false } } } ] } } ] } } ] }
-
Navigate to your project folder in the CLI and run the Liquibase
status
command to see whether the connection is successful:liquibase status --username=test --password=test --changelog-file=<changelog.xml>
Note
You can specify arguments in the CLI or keep them in the Liquibase properties file.
If your connection is successful, you'll see a message like this:
1 changeset has not been applied to <your_jdbc_url> Liquibase command 'status' was executed successfully.
-
Inspect the SQL with the
update-sql
command. Then make changes to your database with theupdate
command.liquibase update-sql --changelog-file=<changelog.xml> liquibase update --changelog-file=<changelog.xml>
If your
update
is successful, Liquibase runs each changeset and displays a summary message ending with:Liquibase: Update has been successful. Liquibase command 'update' was executed successfully.
-
From a database UI tool, ensure that your database contains the
test_table
you added along with the DATABASECHANGELOG table and DATABASECHANGELOGLOCK table.
Now you're ready to start making deployments with Liquibase!
Related links
- Change Types
- Liquibase Commands
- Azure Cosmos DB Documentation
- Azure Cosmos DB: REST API Reference
- Install and use the Azure Cosmos DB Emulator for local development and testing
- Quickstart: Build a Java app to manage Azure Cosmos DB SQL API data
- Azure Cosmos DB Java SDK v4 for Core (SQL) API: release notes and resources
- Azure Cosmos DB Resource URI Syntax for REST
- Tutorial: Connect to an Azure Cosmos account using an Azure Private Endpoint