Liquibase数据类型映射文档

编程入门 行业动态 更新时间:2024-10-27 23:24:36
本文介绍了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数据类型映射文档

本文发布于:2023-10-28 02:01:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1535172.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据类型   文档   Liquibase

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!