Liquibase supports many databases. You can even support different databases at the same time with Liquibase. But what are the "super"-types of Liquibase, which represent the equivalent database types?
Table of Contents
1. Using the right data types for multi database support
Liquibase helps you to manage your database schema. If you use the right Liquibase data type, the mapping down to the right data type on your database will be in the right way. Also you need to know how to map this data type to the corresponding Java data type, which will be shown in following tables.
1.1. Integer data types
The integer based data types.
- Liquibase int
Liquibase DB Type Java type Java type int DB2 INTEGER Integer Long int Derby INTEGER Integer Long int Firebird INT Integer Long int H2 INT Integer Long int Hsql INT Integer Long int Informix INT Integer Long int MSSQL [int] Integer Long int MySQL INT Integer Long int Oracle INTEGER Integer Long int Postgres INT Integer Long int SQLite INTEGER Integer Long int Sybase INT Integer Long int SybaseASA INT Integer Long int Unsupported INT Integer Long - Liquibase mediumint
Liquibase DB Type Java type mediumint DB2 MEDIUMINT Long mediumint Derby MEDIUMINT Long mediumint Firebird MEDIUMINT Long mediumint H2 MEDIUMINT Long mediumint Hsql MEDIUMINT Long mediumint Informix MEDIUMINT Long mediumint MSSQL [int] Long mediumint MySQL MEDIUMINT Long mediumint Oracle MEDIUMINT Long mediumint Postgres MEDIUMINT Long mediumint SQLite MEDIUMINT Long mediumint Sybase MEDIUMINT Long mediumint SybaseASA MEDIUMINT Long mediumint Unsupported MEDIUMINT Long - Liquibase bigint
Liquibase DB Type Java type bigint DB2 BIGINT Long bigint Derby BIGINT Long bigint Firebird BIGINT Long bigint H2 BIGINT Long bigint Hsql BIGINT Long bigint Informix INT8 Long bigint MSSQL [bigint] Long bigint MySQL BIGINT Long bigint Oracle NUMBER(38, 0) Long bigint Postgres BIGINT Long bigint SQLite BIGINT Long bigint Sybase BIGINT Long bigint SybaseASA BIGINT Long bigint Unsupported BIGINT Long - Liquibase tinyint
Liquibase DB Type Java type Java type Java type tinyint DB2 SMALLINT Short Integer Long tinyint Derby SMALLINT Short Integer Long tinyint Firebird SMALLINT Short Integer Long tinyint H2 TINYINT Short Integer Long tinyint Hsql TINYINT Short Integer Long tinyint Informix TINYINT Short Integer Long tinyint MSSQL [tinyint] Short Integer Long tinyint MySQL TINYINT Short Integer Long tinyint Oracle NUMBER(3) Short Integer Long tinyint Postgres SMALLINT Short Integer Long tinyint SQLite TINYINT Short Integer Long tinyint Sybase TINYINT Short Integer Long tinyint SybaseASA TINYINT Short Integer Long tinyint Unsupported TINYINT Short Integer Long
1.2. Floating point data types
Assuming you have an option to test your migration on a local database, which you can rebuild from scratch or from backups. All these following steps assume, that you have a backup!
- Liquibase float
Liquibase DB Type Java type Java type float DB2 FLOAT Float Double float Derby FLOAT Float Double float Firebird FLOAT Float Double float H2 FLOAT Float Double float Hsql FLOAT Float Double float Informix FLOAT Float Double float MSSQL [float](53) Float Double float MySQL FLOAT Float Double float Oracle FLOAT Float Double float Postgres FLOAT Float Double float SQLite FLOAT Float Double float Sybase FLOAT Float Double float SybaseASA FLOAT Float Double float Unsupported FLOAT Float Double - Liquibase double
Liquibase DB Type Java type double DB2 DOUBLE Double double Derby DOUBLE Double double Firebird DOUBLE PRECISION Double double H2 DOUBLE Double double Hsql DOUBLE Double double Informix DOUBLE PRECISION Double double MSSQL [float](53) Double double MySQL DOUBLE Double double Oracle FLOAT(24) Double double Postgres DOUBLE PRECISION Double double SQLite DOUBLE Double double Sybase DOUBLE Double double SybaseASA DOUBLE Double double Unsupported DOUBLE Double
1.3. Decimal data types
- Liquibase decimal
Liquibase DB Type Java type Java type decimal DB2 DECIMAL Decimal BigDecimal decimal Derby DECIMAL Decimal BigDecimal decimal Firebird DECIMAL Decimal BigDecimal decimal H2 DECIMAL Decimal BigDecimal decimal Hsql DECIMAL Decimal BigDecimal decimal Informix DECIMAL Decimal BigDecimal decimal MSSQL [decimal](18, 0) Decimal BigDecimal decimal MySQL DECIMAL Decimal BigDecimal decimal Oracle DECIMAL Decimal BigDecimal decimal Postgres DECIMAL Decimal BigDecimal decimal SQLite DECIMAL Decimal BigDecimal decimal Sybase DECIMAL Decimal BigDecimal decimal SybaseASA DECIMAL Decimal BigDecimal decimal Unsupported DECIMAL Decimal BigDecimal - Liquibase currency
Liquibase DB Type Java type currency DB2 DECIMAL(19, 4) currency Derby DECIMAL currency Firebird DECIMAL(18, 4) currency H2 DECIMAL currency Hsql DECIMAL currency Informix MONEY currency MSSQL [money] currency MySQL DECIMAL currency Oracle NUMBER(15, 2) currency Postgres DECIMAL currency SQLite REAL currency Sybase MONEY currency SybaseASA MONEY currency Unsupported DECIMAL - Liquibase number
Liquibase DB Type Java type number DB2 numeric BigDecimal number Derby numeric BigDecimal number Firebird numeric BigDecimal number H2 NUMBER BigDecimal number Hsql numeric BigDecimal number Informix numeric BigDecimal number MSSQL [numeric](18, 0) BigDecimal number MySQL numeric BigDecimal number Oracle NUMBER BigDecimal number Postgres numeric BigDecimal number SQLite NUMBER BigDecimal number Sybase numeric BigDecimal number SybaseASA numeric BigDecimal number Unsupported NUMBER BigDecimal
1.4. Boolean data type
- Liquibase boolean
Liquibase DB Type Java type boolean DB2 SMALLINT Boolean boolean Derby SMALLINT Boolean boolean Firebird SMALLINT Boolean boolean H2 BOOLEAN Boolean boolean Hsql BOOLEAN Boolean boolean Informix BOOLEAN Boolean boolean MSSQL [bit] Boolean boolean MySQL BIT(1) Boolean boolean Oracle NUMBER(1) Boolean boolean Postgres BOOLEAN Boolean boolean SQLite BOOLEAN Boolean boolean Sybase BIT Boolean boolean SybaseASA BIT Boolean boolean Unsupported BOOLEAN Boolean
1.5. String/character data type
- Liquibase char
Liquibase DB Type Java type char DB2 CHAR String char Derby CHAR String char Firebird CHAR String char H2 CHAR String char Hsql CHAR String char Informix CHAR String char MSSQL [char](1) String char MySQL CHAR String char Oracle CHAR String char Postgres CHAR String char SQLite CHAR String char Sybase CHAR String char SybaseASA CHAR String char Unsupported CHAR String - Liquibase varchar
Liquibase DB Type Java type varchar DB2 VARCHAR String varchar Derby VARCHAR String varchar Firebird VARCHAR String varchar H2 VARCHAR String varchar Hsql VARCHAR String varchar Informix VARCHAR String varchar MSSQL [varchar](1) String varchar MySQL VARCHAR String varchar Oracle VARCHAR2 String varchar Postgres VARCHAR String varchar SQLite VARCHAR String varchar Sybase VARCHAR String varchar SybaseASA VARCHAR String varchar Unsupported VARCHAR String - Liquibase nchar
Liquibase DB Type Java type nchar DB2 NCHAR String nchar Derby NCHAR String nchar Firebird NCHAR String nchar H2 NCHAR String nchar Hsql CHAR String nchar Informix NCHAR String nchar MSSQL [nchar](1) String nchar MySQL NCHAR String nchar Oracle NCHAR String nchar Postgres NCHAR String nchar SQLite NCHAR String nchar Sybase NCHAR String nchar SybaseASA NCHAR String nchar Unsupported NCHAR String - Liquibase nvchar
Liquibase DB Type Java type nvarchar DB2 NVARCHAR String nvarchar Derby VARCHAR String nvarchar Firebird NVARCHAR String nvarchar H2 NVARCHAR String nvarchar Hsql VARCHAR String nvarchar Informix NVARCHAR String nvarchar MSSQL [nvarchar](1) String nvarchar MySQL NVARCHAR String nvarchar Oracle NVARCHAR2 String nvarchar Postgres VARCHAR String nvarchar SQLite NVARCHAR String nvarchar Sybase NVARCHAR String nvarchar SybaseASA NVARCHAR String nvarchar Unsupported NVARCHAR String - Liquibase clob
Liquibase DB Type Java type clob DB2 CLOB String clob Derby CLOB String clob Firebird BLOB SUB_TYPE TEXT String clob H2 CLOB String clob Hsql CLOB String clob Informix CLOB String clob MSSQL [varchar](MAX) String clob MySQL LONGTEXT String clob Oracle CLOB String clob Postgres TEXT String clob SQLite TEXT String clob Sybase TEXT String clob SybaseASA LONG VARCHAR String clob Unsupported CLOB String
1.6. Temporal / date / time data type
- Liquibase date
Liquibase DB Type Java type Java type date DB2 date java.util.Date java.sql.Date date Derby date java.util.Date java.sql.Date date Firebird date java.util.Date java.sql.Date date H2 date java.util.Date java.sql.Date date Hsql date java.util.Date java.sql.Date date Informix date java.util.Date java.sql.Date date MSSQL [date] java.util.Date java.sql.Date date MySQL date java.util.Date java.sql.Date date Oracle date java.util.Date java.sql.Date date Postgres date java.util.Date java.sql.Date date SQLite date java.util.Date java.sql.Date date Sybase date java.util.Date java.sql.Date date SybaseASA date java.util.Date java.sql.Date date Unsupported date java.util.Date java.sql.Date - Liquibase datetime
Liquibase DB Type Java type Java type datetime DB2 TIMESTAMP java.util.Date java.sql.Date datetime Derby TIMESTAMP java.util.Date java.sql.Date datetime Firebird TIMESTAMP java.util.Date java.sql.Date datetime H2 TIMESTAMP java.util.Date java.sql.Date datetime Hsql TIMESTAMP java.util.Date java.sql.Date datetime Informix DATETIME YEAR TO FRACTION(5) java.util.Date java.sql.Date datetime MSSQL [datetime] java.util.Date java.sql.Date datetime MySQL datetime java.util.Date java.sql.Date datetime Oracle TIMESTAMP java.util.Date java.sql.Date datetime Postgres TIMESTAMP WITHOUT TIME ZONE java.util.Date java.sql.Date datetime SQLite TEXT java.util.Date java.sql.Date datetime Sybase datetime java.util.Date java.sql.Date datetime SybaseASA datetime java.util.Date java.sql.Date datetime Unsupported datetime java.util.Date java.sql.Date - Liquibase time
Liquibase DB Type Java type Java type time DB2 time time Derby time time Firebird time time H2 time time Hsql time time Informix INTERVAL HOUR TO FRACTION(5) time MSSQL [time](7) time MySQL time time Oracle DATE time Postgres TIME WITHOUT TIME ZONE time SQLite time time Sybase time time SybaseASA time time Unsupported time - Liquibase timestamp
Liquibase DB Type Java type Java type timestamp DB2 timestamp java.util.Date java.sql.Timestamp timestamp Derby TIMESTAMP java.util.Date java.sql.Timestamp timestamp Firebird TIMESTAMP java.util.Date java.sql.Timestamp timestamp H2 TIMESTAMP java.util.Date java.sql.Timestamp timestamp Hsql TIMESTAMP java.util.Date java.sql.Timestamp timestamp Informix DATETIME YEAR TO FRACTION(5) java.util.Date java.sql.Timestamp timestamp MSSQL [datetime] java.util.Date java.sql.Timestamp timestamp MySQL timestamp java.util.Date java.sql.Timestamp timestamp Oracle TIMESTAMP java.util.Date java.sql.Timestamp timestamp Postgres TIMESTAMP WITHOUT TIME ZONE java.util.Date java.sql.Timestamp timestamp SQLite TEXT java.util.Date java.sql.Timestamp timestamp Sybase datetime java.util.Date java.sql.Timestamp timestamp SybaseASA timestamp java.util.Date java.sql.Timestamp timestamp Unsupported timestamp java.util.Date java.sql.Timestamp
1.7. UUID data type
- Liquibase uuid
Liquibase DB Type Java type uuid DB2 char(36) UUID uuid Derby char(36) UUID uuid Firebird char(36) UUID uuid H2 UUID UUID uuid Hsql char(36) UUID uuid Informix char(36) UUID uuid MSSQL [uniqueidentifier] UUID uuid MySQL char(36) UUID uuid Oracle RAW(16) UUID uuid Postgres UUID UUID uuid SQLite TEXT UUID uuid Sybase UNIQUEIDENTIFIER UUID uuid SybaseASA UNIQUEIDENTIFIER UUID uuid Unsupported char(36) UUID
1.8. Binary data type
- Liquibase blob
Liquibase DB Type Java type blob DB2 BLOB Byte[] blob Derby BLOB Byte[] blob Firebird BLOB Byte[] blob H2 BLOB Byte[] blob Hsql BLOB Byte[] blob Informix BLOB Byte[] blob MSSQL [varbinary](MAX) Byte[] blob MySQL LONGBLOB Byte[] blob Oracle BLOB Byte[] blob Postgres BYTEA Byte[] blob SQLite BLOB Byte[] blob Sybase IMAGE Byte[] blob SybaseASA LONG BINARY Byte[] blob Unsupported BLOB Byte[]
1.9. Function type
- Liquibase function
Liquibase DB Type Java type function DB2 FUNCTION function Derby FUNCTION function Firebird FUNCTION function H2 FUNCTION function Hsql FUNCTION function Informix FUNCTION function MSSQL [function] function MySQL FUNCTION function Oracle FUNCTION function Postgres FUNCTION function SQLite FUNCTION function Sybase FUNCTION function SybaseASA FUNCTION function Unsupported FUNCTION