The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix MySQL/MariaDB collation mismatch failure in v62 legacy_library_root_entity_ids migrations (#75496)
Andersonddd34b2742fb
diff --git a/resources/migrations/062/20260513_legacy_library_root_entity_ids.yaml b/resources/migrations/062/20260513_legacy_library_root_entity_ids.yamlindex b6bdbb7a0ed..a6b66ae15c5 100644--- a/resources/migrations/062/20260513_legacy_library_root_entity_ids.yaml+++ b/resources/migrations/062/20260513_legacy_library_root_entity_ids.yaml@@ -3,6 +3,22 @@databaseChangeLog:- logicalFilePath: migrations/062_update_migrations.yaml+ - changeSet:+ id: v62.legacy-library-root-entity-id-old-id-cleanup+ author: andsalves+ comment: >-+ Delete old changeset rows for the Library Data and Library Metrics entity ID backfills. Those changesets were+ re-id'd after patching their MySQL/MariaDB SQL to resolve a collation mismatch issue, @see #75458.+ changes:+ - sql:+ sql: >-+ DELETE FROM ${databasechangelog.name} WHERE id IN (+ 'v62.2026-05-13T12:00:01',+ 'v62.2026-05-13T12:00:02'+ ) AND filename = 'migrations/062_update_migrations.yaml';+ rollback:+ - empty: {}+- changeSet:id: v62.2026-05-13T11:59:58author: andsalves@@ -55,7 +71,7 @@ databaseChangeLog:- empty: {}- changeSet:- id: v62.2026-05-13T12:00:01+ id: v62.2026-05-13T12:00:01-updatedauthor: andsalvescomment: Backfill canonical entity_id for legacy Library Data sectionchanges:@@ -92,7 +108,7 @@ databaseChangeLog:WHERE type = 'library-data'AND location IN (SELECT loc FROM (- SELECT CONCAT('/', CAST(id AS CHAR), '/') AS loc+ SELECT CONCAT('/', CAST(id AS CHAR), '/') COLLATE utf8mb4_unicode_ci AS locFROM collectionWHERE type = 'library' AND location = '/') lib_loc@@ -103,7 +119,7 @@ databaseChangeLog:FROM collection childWHERE child.type = 'library-data'AND child.location IN (- SELECT CONCAT('/', CAST(lib.id AS CHAR), '/')+ SELECT CONCAT('/', CAST(lib.id AS CHAR), '/') COLLATE utf8mb4_unicode_ciFROM collection libWHERE lib.type = 'library' AND lib.location = '/')@@ -113,7 +129,7 @@ databaseChangeLog:- empty: {}- changeSet:- id: v62.2026-05-13T12:00:02+ id: v62.2026-05-13T12:00:02-updatedauthor: andsalvescomment: Backfill canonical entity_id for legacy Library Metrics sectionchanges:@@ -150,7 +166,7 @@ databaseChangeLog:WHERE type = 'library-metrics'AND location IN (SELECT loc FROM (- SELECT CONCAT('/', CAST(id AS CHAR), '/') AS loc+ SELECT CONCAT('/', CAST(id AS CHAR), '/') COLLATE utf8mb4_unicode_ci AS locFROM collectionWHERE type = 'library' AND location = '/') lib_loc@@ -161,7 +177,7 @@ databaseChangeLog:FROM collection childWHERE child.type = 'library-metrics'AND child.location IN (- SELECT CONCAT('/', CAST(lib.id AS CHAR), '/')+ SELECT CONCAT('/', CAST(lib.id AS CHAR), '/') COLLATE utf8mb4_unicode_ciFROM collection libWHERE lib.type = 'library' AND lib.location = '/')diff --git a/test/metabase/app_db/schema_migrations_test.clj b/test/metabase/app_db/schema_migrations_test.cljindex d4e7f5228d6..c71f4e25566 100644--- a/test/metabase/app_db/schema_migrations_test.clj+++ b/test/metabase/app_db/schema_migrations_test.clj@@ -2893,8 +2893,8 @@(str/trim (t2/select-one-fn :entity_id :collection :id collection-id)))(deftest backfill-legacy-library-root-collection-entity-ids-test- (testing "v62.2026-05-13T12:00:00 through v62.2026-05-13T12:00:02: backfill canonical Library root entity IDs"- (impl/test-migrations ["v62.2026-05-13T12:00:00" "v62.2026-05-13T12:00:02"] [migrate!]+ (testing "v62.2026-05-13T12:00:00 through v62.2026-05-13T12:00:02-updated: backfill canonical Library root entity IDs"+ (impl/test-migrations ["v62.2026-05-13T12:00:00" "v62.2026-05-13T12:00:02-updated"] [migrate!](let [library-id (insert-legacy-library-collection! {:name "Library":slug "library":type "library"@@ -2919,7 +2919,7 @@(deftest backfill-legacy-library-root-collection-entity-ids-test-2(testing "ambiguous Library Data direct children are not modified"- (impl/test-migrations ["v62.2026-05-13T12:00:00" "v62.2026-05-13T12:00:02"] [migrate!]+ (impl/test-migrations ["v62.2026-05-13T12:00:00" "v62.2026-05-13T12:00:02-updated"] [migrate!](let [library-id (insert-legacy-library-collection! {:name "Library":slug "library":type "library"@@ -2951,7 +2951,7 @@(deftest backfill-legacy-library-root-collection-entity-ids-test-3(testing "Library Data collections outside Library root do not count as ambiguous"- (impl/test-migrations ["v62.2026-05-13T12:00:00" "v62.2026-05-13T12:00:02"] [migrate!]+ (impl/test-migrations ["v62.2026-05-13T12:00:00" "v62.2026-05-13T12:00:02-updated"] [migrate!](let [library-id (insert-legacy-library-collection! {:name "Library":slug "library":type "library"@@ -2979,7 +2979,7 @@(deftest backfill-legacy-library-root-collection-entity-ids-test-4(testing "pre-existing canonical Library rows with missing types prevent entity_id collisions"- (impl/test-migrations ["v62.2026-05-13T11:59:58" "v62.2026-05-13T12:00:02"] [migrate!]+ (impl/test-migrations ["v62.2026-05-13T11:59:58" "v62.2026-05-13T12:00:02-updated"] [migrate!](let [canonical-library-id (insert-legacy-library-collection! {:name "Pre-existing canonical Library":slug "canonical-library":type nil