From 997611c6b1b6fff8b234482865bf321eaaecd510 Mon Sep 17 00:00:00 2001 From: Ngoc Khuat <qn.khuat@gmail.com> Date: Wed, 6 Jul 2022 22:05:15 +0700 Subject: [PATCH] Update some migrations added in 44 to make sure we don't break downgrade ability (#23723) * change metabase_fieldvalues.type from text to varchar so we could have a defaultValue * change report_card.parameters and report_card.parameter_mappings to nullable * metabase_fieldvalues.type is not nullable * varchar(254) -> varchar(32) --- resources/migrations/000_migrations.yaml | 40 ++------------------- test/metabase/db/schema_migrations_test.clj | 5 +-- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/resources/migrations/000_migrations.yaml b/resources/migrations/000_migrations.yaml index 21e01137029..355234471f2 100644 --- a/resources/migrations/000_migrations.yaml +++ b/resources/migrations/000_migrations.yaml @@ -11806,19 +11806,6 @@ databaseChangeLog: remarks: List of parameter associated to a card constraints: nullable: true - deferrable: false - initiallyDeferred: false - - changeSet: - id: v44.00-024 - author: qnkhuat - comment: Added 0.44.0 - Add parameters to report_card - changes: - - addNotNullConstraint: - columnDataType: ${text.type} - columnName: parameters - defaultNullValue: '[]' - tableName: report_card - - changeSet: id: v44.00-025 author: qnkhuat @@ -11833,18 +11820,6 @@ databaseChangeLog: remarks: List of parameter associated to a card constraints: nullable: true - deferrable: false - initiallyDeferred: false - - changeSet: - id: v44.00-026 - author: qnkhuat - comment: Added 0.44.0 - Add parameter_mappings to report_card - changes: - - addNotNullConstraint: - columnDataType: ${text.type} - columnName: parameter_mappings - defaultNullValue: '[]' - tableName: report_card - changeSet: id: v44.00-027 @@ -11918,20 +11893,11 @@ databaseChangeLog: columns: - column: name: type - type: ${text.type} + type: varchar(32) + defaultValue: 'full' remarks: Type of FieldValues constraints: - nullable: true - - changeSet: - id: v44.00-036 - author: qnkhuat - comment: Added 0.44.0 - Add default value for metabase_fieldvalues.type - changes: - - addNotNullConstraint: - columnDataType: ${text.type} - columnName: type - defaultNullValue: 'full' - tableName: metabase_fieldvalues + nullable: false - changeSet: id: v44.00-037 author: qnkhuat diff --git a/test/metabase/db/schema_migrations_test.clj b/test/metabase/db/schema_migrations_test.clj index 24f0b3bf790..5fb6849c7f5 100644 --- a/test/metabase/db/schema_migrations_test.clj +++ b/test/metabase/db/schema_migrations_test.clj @@ -595,7 +595,8 @@ :database_id database-id :collection_id nil})] (migrate!) - (is (= [] (:parameters (first (db/simple-select Card {:where [:= :id card-id]}))))))))) + (is (= nil + (:parameters (first (db/simple-select Card {:where [:= :id card-id]}))))))))) (deftest add-parameter-mappings-to-cards-test (testing "Migration v44.00-024: Add parameter_mappings to cards" @@ -619,7 +620,7 @@ :database_id database-id :collection_id nil})] (migrate!) - (is (= [] + (is (= nil (:parameter_mappings (first (db/simple-select Card {:where [:= :id card-id]}))))))))) (deftest grant-all-users-root-snippets-collection-readwrite-perms-test -- GitLab