Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blobs and Liquibase generateChangeLog

We have just started using liquibase at our shop. We use postgresql 9.3

We are trying to use

liquibase --diffTypes=data generateChangeLog

to create changelogs for our activitii tables.

These tables use bytea columns to store PNG data. However, when we run the generateChangeLog, the value from liquibase is not what is in the column. Instead were getting this.

 <insert tableName="act_ge_bytearray">
        <column name="id_" value="148802"/>
        <column name="rev_" valueNumeric="1"/>
        <column name="name_" value="image/jpeg"/>
        <column name="deployment_id_"/>
        <column name="bytes_" value="[B@4d513b99"/>
        <column name="generated_"/>
    </insert>

The actual data in bytes_ is a binary representation of a PNG file. I wont paste that here as its fairly long, but as you can see, liquibase does not copy over the correct data.

Is there any way to address this so that generateChangeLog returns whats actually stored in the bytea column?

Thanks for any help.

like image 457
MFD3000 Avatar asked Nov 01 '22 17:11

MFD3000


1 Answers

Liquibase does not currently handle blob contents well, both with generateChangeLog and through the standard tags. Part of the reason for this is because how different databases handle them varies greatly.

Your best approach would be to use the generateChangeLog output as a starting point and modify it to load in the blob files through blocks as best works with your database.

like image 81
Nathan Voxland Avatar answered Nov 11 '22 19:11

Nathan Voxland