来自 generateChangeLog 的 Liquibase 列数据类型
Liquibase column data types from generateChangeLog
我有两个数据库,一个在 DB2 上,一个在 ORACLE 上。我已经通过 generateChangeLog 命令生成了更改日志文件。它为我生成了正确的 xml 文件,但仅限于 Oracle 数据库。我在 oracle 数据库上调用这个命令,结果我得到了像 NUMBER(*,0) 这样的列数据类型,这在 DB2 上是无效的。如何在liquibase中生成统一数据类型的ChangeLog?
liquibase 中是否存在一些数据类型列表?假设哪些数据库适用于所有数据库?
将现有的数据库模式反向工程为 Liquibase XML 文件总是创建 DBMS 特定的数据类型。您必须编辑生成的 XML 文件才能使用 JDBC 类型。
手册中记录了支持的“跨平台”类型:
http://www.liquibase.org/documentation/column.html
To help make scripts database-independent, the following “generic” data types will be converted to the correct database implementation:
- BOOLEAN
- CURRENCY
- UUID
- CLOB
- BLOB
- DATE
- DATETIME
- TIME
- BIGINT
Also, specifying a java.sql.Types.* type will be converted to the correct type as well. If needed, precision can be included. Here are some examples:
- java.sql.Types.TIMESTAMP
- java.sql.Types.VARCHAR(255)
根据我的经验,第一个列表缺少 INTEGER
和 DECIMAL
,它们也可以毫无问题地使用(至少对于 Oracle 和 Postgres - 没有 DB2 来测试它)。
我有两个数据库,一个在 DB2 上,一个在 ORACLE 上。我已经通过 generateChangeLog 命令生成了更改日志文件。它为我生成了正确的 xml 文件,但仅限于 Oracle 数据库。我在 oracle 数据库上调用这个命令,结果我得到了像 NUMBER(*,0) 这样的列数据类型,这在 DB2 上是无效的。如何在liquibase中生成统一数据类型的ChangeLog?
liquibase 中是否存在一些数据类型列表?假设哪些数据库适用于所有数据库?
将现有的数据库模式反向工程为 Liquibase XML 文件总是创建 DBMS 特定的数据类型。您必须编辑生成的 XML 文件才能使用 JDBC 类型。
手册中记录了支持的“跨平台”类型:
http://www.liquibase.org/documentation/column.html
To help make scripts database-independent, the following “generic” data types will be converted to the correct database implementation:
- BOOLEAN
- CURRENCY
- UUID
- CLOB
- BLOB
- DATE
- DATETIME
- TIME
- BIGINT
Also, specifying a java.sql.Types.* type will be converted to the correct type as well. If needed, precision can be included. Here are some examples:
- java.sql.Types.TIMESTAMP
- java.sql.Types.VARCHAR(255)
根据我的经验,第一个列表缺少 INTEGER
和 DECIMAL
,它们也可以毫无问题地使用(至少对于 Oracle 和 Postgres - 没有 DB2 来测试它)。