dbms
The dbms
attribute is a string that specifies which database Liquibase should run a changeset on. dbms
accepts "short names" of database management systems. Valid values are:
all
: allow this change to deploy to all supported databasesnone
: allow this change to deploy nowhereaerospike
: Aerospikeasany
: SAP SQL Anywherebigquery
: Google BigQuerycassandra
: Apache Cassandracloudspanner
: Spannercockroachdb
: CockroachDBcosmosdb
: Azure Cosmos DBdatabricks
: Databricksdb2
: IBM DB2 on LUWdb2i
: IBM DB2 on idb2z
: IBM DB2 on z/OSderby
: Apache Derbydynamodb
: Amazon DynamoDBedb
: EnterpriseDBfirebird
: Firebirdhana
: SAP HANAh2
: H2 Database Enginehsqldb
: HyperSQL Databaseinformix
: Informixingres
: Ingres Databasemariadb
: MariaDBmaxdb
: SAP MaxDBmongodb
: MongoDBmssql
: Microsoft SQL Servermysql
: MySQLneo4j
: Neo4J Graph Databaseoracle
: Oraclepostgresql
: PostgreSQLredshift
: Amazon Redshiftsnowflake
: Snowflakesqlite
: SQLitesybase
: SAP Adaptive Serverteradata
: Teradatavertica
: Verticayugabytedb
: YugabyteDB
Separate multiple values with commas. Specify that a changeset is not applicable to a particular database type by prefixing with !
The default value is all
.
Uses
If you're deploying a changelog to multiple database management systems (DBMSs), you may want to ensure that a certain changeset is only deployed to one type of database. For example, you might want to deploy some stored logic only to your PostgreSQL databases because the logic uses a keyword that doesn't exist on your Oracle databases. You can specify
Note: Liquibase dynamically uses the database connection URL to determine what database you're currently connected to, not the value of dbms
.
Syntax
--liquibase formatted sql
--changeset your.name:1 dbms:postgresql,oracle
create table person (
name varchar(255)
);
{
"databaseChangeLog":[
{
"changeSet": {
"author": "your.name",
"id": "1",
"dbms": "postgresql,oracle",
"changes": [
{
"createTable": {
"tableName": "person",
"columns": [
{
"column": {
"name": "name",
"type": "varchar(255)"
}
}
]
}
}
]
}
}
}
databaseChangeLog:
- changeSet:
author: your.name
id: 1
dbms: postgresql,oracle
changes:
- createTable:
tableName: person
columns:
- column:
name: name
type: varchar(255)
<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 author="your.name" id="1" dbms="postgresql,oracle">
<createTable tableName="person">
<column name="name" type="varchar(255)"/>
</createTable>
</changeSet>
</databaseChangeLog>