强制 Liquibase 将 Blob 映射到 PostgreSQL 上的 BYTEA
Force Liquibase to map Blob to BYTEA on PostgreSQL
如何告诉 Liquibase 将 BLOB 数据类型映射到 PostgreSQL 上的 BYTEA?
似乎 Hibernate 的人已经接手并根据他们的需要调整了该工具:https://liquibase.jira.com/browse/CORE-1863 , however, EclipseLink don't support oid's and the bug seems to be still open: https://bugs.eclipse.org/bugs/show_bug.cgi?id=337467
我需要使用 EclipseLink,我需要将 blob 与 PostgreSQL 结合使用。我想使用 Liquibase,是否可以让这些东西协同工作?
你有两个选择。
如果您只需要将此用于 Postgres 并且不打算支持其他 DBMS,只需使用 bytea
作为列类型。
在 column tag 的描述中未列为 "generic" 类型之一的任何数据类型将被传递 "as-is" 到数据库,例如
<createTable tableName="foo">
<column name="id" type="integer"/>
<column name="picture" type="bytea"/>
</createTable>
如果要支持不同的DBMS,可以根据DBMS定义一个属性:
<property name="blob_type" value="bytea" dbms="postgresql"/>
<property name="blob_type" value="blob" dbms="oracle"/>
然后
<createTable tableName="foo">
<column name="id" type="integer"/>
<column name="picture" type="${blob_type}"/>
</createTable>
如何告诉 Liquibase 将 BLOB 数据类型映射到 PostgreSQL 上的 BYTEA?
似乎 Hibernate 的人已经接手并根据他们的需要调整了该工具:https://liquibase.jira.com/browse/CORE-1863 , however, EclipseLink don't support oid's and the bug seems to be still open: https://bugs.eclipse.org/bugs/show_bug.cgi?id=337467
我需要使用 EclipseLink,我需要将 blob 与 PostgreSQL 结合使用。我想使用 Liquibase,是否可以让这些东西协同工作?
你有两个选择。
如果您只需要将此用于 Postgres 并且不打算支持其他 DBMS,只需使用 bytea
作为列类型。
在 column tag 的描述中未列为 "generic" 类型之一的任何数据类型将被传递 "as-is" 到数据库,例如
<createTable tableName="foo">
<column name="id" type="integer"/>
<column name="picture" type="bytea"/>
</createTable>
如果要支持不同的DBMS,可以根据DBMS定义一个属性:
<property name="blob_type" value="bytea" dbms="postgresql"/>
<property name="blob_type" value="blob" dbms="oracle"/>
然后
<createTable tableName="foo">
<column name="id" type="integer"/>
<column name="picture" type="${blob_type}"/>
</createTable>