fix(import-db): replace modern collations with server default, fixes #8129, fixes #8130#8138
Conversation
|
Download the artifacts for this pull request:
See Testing a PR. |
|
Looks like actual problems, https://buildkite.com/ddev/ddev-macos-arm64-mutagen/builds/12817#019c586f-8b91-406a-abbf-60ea3eaf1329 |
7c31cf8 to
2fe5c2d
Compare
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6cd3be1 to
22ca621
Compare
|
I fiddled slightly with docs and added a case to a test. I ran the full TestDdevAllDatabases and TestDdevImportDB and they were OK. Unfortunately, I can't seem to get this to work with the repro case in It seems like it's still broken. I experimented with several |
That repro case is incorrect, because the example file has -sed -e 's/utf8_general_ci/utf8mb4_0900_ai_ci/' .ddev/mysql/character-set.cnf.example > .ddev/mysql/character-set.cnf
+cat > .ddev/mysql/collation-server.cnf <<EOF
+[mysqld]
+collation-server = utf8mb4_0900_ai_ci
+EOFcat > .ddev/mysql/collation-server.cnf <<EOF
[mysqld]
collation-server = utf8mb4_0900_ai_ci
EOFSee the manual instructions in this PR. |
The Issue
How This PR Solves The Issue
Previous behavior: The import logic replaced modern collations (
utf8mb4_0900_ai_cifrom MySQL 8.0+ andutf8mb4_uca1400_ai_cifrom MariaDB 11.x) with a hardcoded fallback ofutf8mb4_unicode_ci.New behavior: Before importing, we now query the database server's default collation using
SELECT @@collation_serverand use that value as the replacement target. This respects the actual server configuration instead of assuming a specific collation.This PR:
collation_server = utf8mb4_0900_ai_ci), the import will now preserve those collations instead of forcing a downgrade to an older collation. This gives users control over their collation.Manual Testing Instructions
From #8130:
The same can be repeated for
mysql:5.7ormariadb:11.8ormariadb:10.5:You shouldn't see illegal mix of collations in the browser.
And repeat the same thing in the same project, but this time with
utf8mb4_0900_ai_ciin MySQL 8.0 (ddev launchshows a mixed collation with DDEV v1.25.0):Automated Testing Overview
Release/Deployment Notes