Liquibase数据类型映射文档 [英] Liquibase Data Type Mapping documentation

查看:178
本文介绍了Liquibase数据类型映射文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,这个问题看起来很愚蠢,但我尝试了1个小时搜索,没有找到任何东西。
因此,当我说:

 时,我使用liquibase处理多个数据库(例如MSSQL,Oracle和MySQL) addColumn(tableName:ABC_TEST){
column(name:IS_ACTIVE,type:boolean)
}

如何知道类型boolean是否会转换为适合每个数据库的类型?
是否有任何文档可以找到数据类型映射?如果我想添加一个外键列,那么我应该使用哪种类型的? 解决方案

结帐此问题(和答案)以查看liquibase提供的可用类型。

在我对此问题的回答中,有一个指向相关的liquibase类来完成对数据库特定类型的转换。

当您创建主键为liquibase type的表时,liquibase会将其转换为数据库特定类型。
然后你的外键应该只使用相同的类型,liquibase会翻译它。


例如,查看课程 BigIntType
使用liquibase,您只需使用liquibase类型: BIGINT
在Oracle DB上,它将转换为(NUMBER,38,0)
在MSSQL上它会翻译成(BIGINT)

Sorry, this question seems stupid, but I tried 1 hour searching and didn't find anything. So I'm using liquibase for multiple databases(e.g. MSSQL, Oracle and MySQL), when I say:

addColumn(tableName: "ABC_TEST") {
  column(name: "IS_ACTIVE", type: "boolean")
} 

How do I know if the type "boolean" will be converted to proper types for each database? And is there any documentation I can find for the data type mapping? If I want to add one more column which is foreign key, which type should I use?

解决方案

Checkout this question (and answers) to see the available types that liquibase offers.

In my answer to that question there is a link to the relevant liquibase classes that do the translation to the db specific types.

When you created the table that has the primary key with a "liquibase type" then liquibase will have translated this to the db specific type. Then your foreign key should just use the same type and liquibase will translate this likewise.

E.g. check out the class BigIntType. With liquibase you would just use the "liquibase type": BIGINT. On Oracle DBs it will translate to ("NUMBER", 38,0). On MSSQL it will translate to ("BIGINT").

这篇关于Liquibase数据类型映射文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆