From 9d087608d3d78589f9669dee0d6503959e7ed199 Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Fri, 20 Nov 2026 15:20:53 +0100 Subject: [PATCH] test: accept MariaDB collation aliases in schema checks --- integration_db_test.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/integration_db_test.go b/integration_db_test.go index 3e82e9a..12c1587 100644 --- a/integration_db_test.go +++ b/integration_db_test.go @@ -143,9 +143,11 @@ func TestIntegrationMigrations(t *testing.T) { if err != nil || version != 2 { t.Fatal(version, err) } + // MariaDB can report a charset-prefixed collation alias in TABLES + // even when its COLLATIONS view only lists the unprefixed name. for _, table := range []string{"coredns_webui_schema", "coredns_webui_users", "coredns_webui_sessions", "coredns_webui_zone_delegations", "coredns_webui_audit"} { - if d.count(t, "SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ? AND TABLE_COLLATION IN (SELECT COLLATION_NAME FROM information_schema.COLLATIONS WHERE CHARACTER_SET_NAME = 'utf8mb4') AND ENGINE = 'InnoDB'", table) != 1 { - t.Fatalf("%s missing", table) + if d.count(t, "SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = ? AND LEFT(TABLE_COLLATION, 8) = 'utf8mb4_' AND ENGINE = 'InnoDB'", table) != 1 { + t.Fatalf("%s missing or has a different character set or engine", table) } } if n := d.count(t, "SELECT COUNT(*) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND DATA_TYPE = 'datetime' AND DATETIME_PRECISION = 6"); n != 9 {