From 5bd841afb79a8eead10a2620d2ebc568ceb50a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Thomas?= Date: Fri, 3 Jan 2020 18:42:58 +0100 Subject: [PATCH] Change avatar storage column to bytea for PostgreSQL In PostgreSQL, Liquibase maps the `blob` type to an `oid` column by default[1]. That column type is not supported[2] very well when using the `valueBlobFile` attribute, which expects a `bytea` column instead. This was confirmed on all PostgreSQL versions starting from 9.6. The `validCheckSum` attribute does not need to be updated since it was already for the previous (binary_type, varchar_type) combination in an unrelated commit (78a99d58604169db4a0d2a1f5c9c490fa32dc49b). Fixes #1213. [1] https://liquibase.jira.com/browse/CORE-1863 [2] https://github.com/liquibase/liquibase/pull/605 --- .../main/resources/liquibase/db-changelog.xml | 1 + .../resources/liquibase/legacy/schema35.xml | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/airsonic-main/src/main/resources/liquibase/db-changelog.xml b/airsonic-main/src/main/resources/liquibase/db-changelog.xml index 6004cb0f..cddd1401 100644 --- a/airsonic-main/src/main/resources/liquibase/db-changelog.xml +++ b/airsonic-main/src/main/resources/liquibase/db-changelog.xml @@ -3,6 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> + diff --git a/airsonic-main/src/main/resources/liquibase/legacy/schema35.xml b/airsonic-main/src/main/resources/liquibase/legacy/schema35.xml index 24adac97..9641f38e 100644 --- a/airsonic-main/src/main/resources/liquibase/legacy/schema35.xml +++ b/airsonic-main/src/main/resources/liquibase/legacy/schema35.xml @@ -59,6 +59,20 @@ + + + + + SELECT DATA_TYPE + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = 'system_avatar' + AND COLUMN_NAME = 'data' + + + + ALTER TABLE system_avatar ALTER COLUMN data TYPE bytea USING lo_get(data); + + 8:d428266eb794ae2f1361a6eec0f67672 @@ -91,6 +105,20 @@ + + + + + SELECT DATA_TYPE + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_NAME = 'custom_avatar' + AND COLUMN_NAME = 'data' + + + + ALTER TABLE custom_avatar ALTER COLUMN data TYPE bytea USING lo_get(data); + + 8:60a4f99dea63d7813457a1b8f981f763