给定一个包含以下列的表格:
<column name="image" type="longblob">
<constraints nullable="true" />
</column>
<column name="image_content_type" type="varchar(255)">
<constraints nullable="true" />
</column>
如何从文件上传图像,例如我的图像.jpeg?底层数据库是 PostgreSQL。
最佳答案
下面的 changeSet 可以满足我的需求:
<changeSet id="632342634534534e53" author="developer">
<update schemaName="public"
tableName="my_table">
<column name="image" type="longblob" valueBlobFile="../../../images/1.MyImage.jpg"/>
<column name="image_content_type" type="varchar(255)" value="image/jpeg"/>
<where>id = 1</where>
</update>
</changeSet>
这是图像的路径:
/src/main/resources/images
这是更新日志的路径:
/src/main/resources/config/liquibase/changelog/MyChangelog.xml
关于postgresql - JHipster-Liquibase : How to upload an Image file blob?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50470598/