Skip to content

fix: pin MySQL schemas to utf8mb4_unicode_ci - #12

Merged
jcviljoen merged 1 commit into
mainfrom
bugfix/redelivery-schema-collation-is-broken
May 20, 2026
Merged

fix: pin MySQL schemas to utf8mb4_unicode_ci#12
jcviljoen merged 1 commit into
mainfrom
bugfix/redelivery-schema-collation-is-broken

Conversation

@jcviljoen

@jcviljoen jcviljoen commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • The MySQL DDL templates and boot-time schema helpers declared DEFAULT CHARSET=utf8mb4 with no COLLATE clause, so each table inherited whatever the schema/server default was at creation time. On MySQL 8 the join in SqlRedeliveryStore::fetchNextDueRow (event_outbox_redelivery.event_idevent_outbox.id) fails with SQLSTATE 1267 "Illegal mix of collations" when the two tables land on different defaults (e.g. utf8mb4_unicode_ci vs utf8mb4_0900_ai_ci).
  • Pin COLLATE=utf8mb4_unicode_ci at the table level on event_outbox, event_outbox_status, and event_outbox_redelivery in both the migrations/mysql/0001_*.sql templates and the matching MysqlEventStoreSchema / MysqlRedeliverySchema boot-time helpers.
  • Add a regression test (tests/Feature/MysqlSchemaCollationTest.php) that runs the shipped DDL and the boot-time helpers against a live MySQL, then queries information_schema.columns and asserts utf8mb4_unicode_ci on the four join-key columns (event_outbox.id, event_outbox_status.event_id, event_outbox_redelivery.event_id, event_outbox_redelivery.listener). Gated on EVENTS_MYSQL_DSN (with optional EVENTS_MYSQL_USER / EVENTS_MYSQL_PASSWORD); skips cleanly when unset, so the existing SQLite-only test suite is unaffected.

🤖 Generated with Claude Code

Without an explicit COLLATE, event_outbox and event_outbox_redelivery
inherit whatever the schema/server default is at creation time, which
can fail SqlRedeliveryStore::fetchNextDueRow with SQLSTATE 1267
"Illegal mix of collations" when the two tables land on different
defaults (e.g. utf8mb4_unicode_ci vs utf8mb4_0900_ai_ci on MySQL 8).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jcviljoen
jcviljoen merged commit a946871 into main May 20, 2026
1 check passed
@jcviljoen
jcviljoen deleted the bugfix/redelivery-schema-collation-is-broken branch May 20, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant