test: accept MariaDB collation aliases in schema checks
Test / test (push) Successful in 22m36s

This commit is contained in:
bryanpedini committed 2026-11-20 15:20:53 +01:00
1 parent d34894c9cd
commit 9d087608d3
1 file changed
+4 -2
+4 -2
View File
@@ -143,9 +143,11 @@ func TestIntegrationMigrations(t *testing.T) {
if err != nil || version != 2 { if err != nil || version != 2 {
t.Fatal(version, err) 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"} { 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 { 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", table) 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 { 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 {