fix: pin MySQL schemas to utf8mb4_unicode_ci - #12
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DEFAULT CHARSET=utf8mb4with noCOLLATEclause, so each table inherited whatever the schema/server default was at creation time. On MySQL 8 the join inSqlRedeliveryStore::fetchNextDueRow(event_outbox_redelivery.event_id→event_outbox.id) fails with SQLSTATE 1267 "Illegal mix of collations" when the two tables land on different defaults (e.g.utf8mb4_unicode_civsutf8mb4_0900_ai_ci).COLLATE=utf8mb4_unicode_ciat the table level onevent_outbox,event_outbox_status, andevent_outbox_redeliveryin both themigrations/mysql/0001_*.sqltemplates and the matchingMysqlEventStoreSchema/MysqlRedeliverySchemaboot-time helpers.tests/Feature/MysqlSchemaCollationTest.php) that runs the shipped DDL and the boot-time helpers against a live MySQL, then queriesinformation_schema.columnsand assertsutf8mb4_unicode_cion the four join-key columns (event_outbox.id,event_outbox_status.event_id,event_outbox_redelivery.event_id,event_outbox_redelivery.listener). Gated onEVENTS_MYSQL_DSN(with optionalEVENTS_MYSQL_USER/EVENTS_MYSQL_PASSWORD); skips cleanly when unset, so the existing SQLite-only test suite is unaffected.🤖 Generated with Claude Code