Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Is utf8mb4 support planned ?
Comment | File | Size | Author |
---|---|---|---|
#18 | support_for_utf8mb4-2764111-18.patch | 5.35 KB | Thomas Bosviel |
#12 | support_for_utf8mb4-2764111-12.patch | 2.2 KB | Thomas Bosviel |
#10 | support_for_utf8mb4-2764111-10.patch | 2.38 KB | Thomas Bosviel |
#7 | support_for_utf8mb4-2764111-7.patch | 2.32 KB | helmo |
#5 | support_for_utf8mb4-2764111-4.patch | 2.39 KB | helmo |
Comments
Comment #2
acWould be nice to have update to this as an option on migrate/clone.
Comment #3
helmo CreditAttribution: helmo at Initfour websolutions commentedYes, we have to support it somehow.
Steps:
We currently don't control the my.cnf ... so that part is up to the sysadmin.
Converting databases might be risky to fully automate ... we could create a task for it which could then be run via e.g. Views bulk operations. But I'm not sure it's worth the effort. Unless we find someone to do or sponsor it.
Comment #4
helmo CreditAttribution: helmo at Initfour websolutions commentedAs we don't want to add the extra connection details to pre Drupal 7.50 sites we'd have to add a check. Here's a work in progress ... This currently fails on
Error: Class 'Database' not found in...
Comment #5
helmo CreditAttribution: helmo at Initfour websolutions commentedComment #6
colanJust in case anyone sees this warning output from Drush:
It shouldn't be a warning, and has already been fixed upstream (but will take time to trickle down). See There is no documented way to suppress warnings about missing 4 byte UTF-8 support.
Comment #7
helmo CreditAttribution: helmo at Initfour websolutions commentedI've for now simplified the to check to a drush_get_option() call.
Add to e.g. /etc/drush/drushrc.php
Comment #8
Thomas Bosviel CreditAttribution: Thomas Bosviel as a volunteer and commentedIt works for a fresh install of Drupal 7.50. Sites migrated to 7.50 without database converted also works.
After a verify task, site <7.50 throws an exception PDOException with message:
Syntax error or access violation: 1253 COLLATION 'utf8mb4_general_ci' is not valid for CHARACTER SET 'utf8'
To solve this issue, we can check if Drupal version supports utf8mb4:
Comment #9
helmo CreditAttribution: helmo at Initfour websolutions commentedThe difficulty there is that during the verify task Drupal is not bootstrapped far enough to have $connection available.
We have package info in our frontend database, but not in the drush context about a platform.
Comment #10
Thomas Bosviel CreditAttribution: Thomas Bosviel as a volunteer and commentedAn alternative would be to detect the version number of the Drupal installation.
Comment #11
helmo CreditAttribution: helmo at Initfour websolutions commentedThanks that check works well.
I think we can even remove the drush_get_option('utf8mb4IsSupported') call, as Drupal 7.50+ will work OK anyway. It'll just mention on admin/reports/status that your db is not converted yet.
Comment #12
Thomas Bosviel CreditAttribution: Thomas Bosviel as a volunteer and commentedYes, you're right. Patch updated.
Comment #14
helmo CreditAttribution: helmo at Initfour websolutions commentedThanks, committed.
Comment #16
helmo CreditAttribution: helmo at Initfour websolutions commented:( Install now fails
http://ci.aegirproject.org/job/P_Aegir_Puppet_Module_functional_test_Aeg...
I think we have to use the extra drush_get_option anyway. I've added it for now, making Jenkins happy http://ci.aegirproject.org/job/P_Aegir_Puppet_Module_functional_test_Aeg...
Maybe we can create a property on the db server class to indicate if a server supports it.
Comment #17
Thomas Bosviel CreditAttribution: Thomas Bosviel as a volunteer and commentedYes, we could reuse the code from DatabaseConnection_mysql::utf8mb4IsSupported to automatically set the db server class property on
provision-save
.Comment #18
Thomas Bosviel CreditAttribution: Thomas Bosviel as a volunteer and commentedCheck database 4 byte UTF-8 support for Drupal 7 and create
utf8mb4_is_supported
property in db service class.Comment #20
helmo CreditAttribution: helmo at Initfour websolutions for Aegir Cooperative commentedThanks, looks good. Committed.
Comment #22
sseidel CreditAttribution: sseidel as a volunteer commentedAFAICS the function
utf8mb4_is_supported()
will never return TRUE on any database that uses InnoDB. InnoDB's max key length is 767 bytes, utf8mb4 uses up to 4 bytes per codepoint, so the maximum CHAR/VARCHAR key length is 191. Subsequently, the CREATE TABLE statement will sayERROR 1071 (42000): Specified key was too long; max key length is 767 bytes
even if utf8mb4 is supported.Comment #23
Thomas Bosviel CreditAttribution: Thomas Bosviel as a volunteer and commentedDid you allowed innodb large indexes ? For more details #2488180: Support full UTF-8 (emojis, Asian symbols, mathematical symbols) on MySQL and other database drivers when they are configured to allow it