From b76e26fac35873ca73dd58656ed656ec25f9f84c Mon Sep 17 00:00:00 2001 From: John Swanson <john.swanson@metabase.com> Date: Mon, 20 May 2024 15:20:05 -0700 Subject: [PATCH] Correct type for `report_card.collection_preview` (#42919) In v49, we converted all boolean types to `bit(1)` on mysql/mariadb. It looks like we missed this one, so when you `GET` a card it has `"collection_preview": 1`. Then we get an error when trying to save, because `collection_preview` should be a boolean. I verified that after this migration, `GET`ting a card results in a boolean `"collection_preview"`. --- .../migrations/001_update_migrations.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/resources/migrations/001_update_migrations.yaml b/resources/migrations/001_update_migrations.yaml index f676217d8c5..74cf2e0e797 100644 --- a/resources/migrations/001_update_migrations.yaml +++ b/resources/migrations/001_update_migrations.yaml @@ -7335,6 +7335,57 @@ databaseChangeLog: - customChange: class: "metabase.db.custom_migrations.MigrateMetricsToV2" + - changeSet: + id: v51.2024-05-20T19:10:34 + author: johnswanson + comment: >- + Modify type of report_card.collection_preview to ${boolean.type} on mysql,mariadb + dbms: mysql,mariadb + changes: + - modifyDataType: + tableName: report_card + columnName: collection_preview + newDataType: ${boolean.type} + rollback: + - modifyDataType: + tableName: report_card + columnName: collection_preview + newDataType: boolean + defaultValueBoolean: true + preConditions: + - onFail: MARK_RAN + - dbms: + type: mysql,mariadb + + - changeSet: + id: v51.2024-05-20T20:37:55 + author: johnswanson + comment: Add NOT NULL constraint to report_card.collection_preview + changes: + - addNotNullConstraint: + columnDataType: ${boolean.type} + tableName: report_card + columnName: collection_preview + defaultNullValue: true + preConditions: + - onFail: MARK_RAN + - dbms: + type: mysql,mariadb + + - changeSet: + id: v51.2024-05-20T20:38:34 + author: johnswanson + comment: Add default value to report_card.collection_preview + changes: + - addDefaultValue: + defaultValueBoolean: true + tableName: report_card + columnName: collection_preview + preConditions: + - onFail: MARK_RAN + - dbms: + type: mysql,mariadb + # >>>>>>>>>> DO NOT ADD NEW MIGRATIONS BELOW THIS LINE! ADD THEM ABOVE <<<<<<<<<< ######################################################################################################################## -- GitLab