mysql: explicitly use utf8mb3

this fixes mysql v8.x.
in mysql 8.0+ utf8mb3 is deprecated and utf8 alias doesn't work.

Change-Id: I548eb43a3d5adbd84957b6b92d4b172bfdfb80a8
This commit is contained in:
Alexander Epaneshnikov 2023-04-07 17:06:17 +03:00 committed by wu.chunyang
parent 7a6666f4f3
commit 3ba1f0d955
6 changed files with 12 additions and 8 deletions

View File

@ -1,8 +1,8 @@
{ {
"databases": [ "databases": [
{ {
"character_set": "utf8", "character_set": "utf8mb3",
"collate": "utf8_general_ci", "collate": "utf8mb3_general_ci",
"name": "databaseA" "name": "databaseA"
}, },
{ {

View File

@ -10,8 +10,8 @@
}, },
"databases": [ "databases": [
{ {
"character_set": "utf8", "character_set": "utf8mb3",
"collate": "utf8_general_ci", "collate": "utf8mb3_general_ci",
"name": "sampledb" "name": "sampledb"
}, },
{ {

View File

@ -0,0 +1,2 @@
fixes:
- explicitly specify utf8mb3 as character set for mysql

View File

@ -79,6 +79,7 @@ charset = {"big5": ["big5_chinese_ci", "big5_bin"],
"utf8_general_mysql500_ci" "utf8_general_mysql500_ci"
], ],
"utf8mb4": ["utf8mb4_0900_ai_ci"], "utf8mb4": ["utf8mb4_0900_ai_ci"],
"utf8mb3": ["utf8mb3_general_ci"],
"ucs2": ["ucs2_general_ci", "ucs2": ["ucs2_general_ci",
"ucs2_bin", "ucs2_bin",
"ucs2_unicode_ci", "ucs2_unicode_ci",
@ -268,6 +269,7 @@ collation = {"big5_chinese_ci": "big5",
"armscii8_general_ci": "armscii8", "armscii8_general_ci": "armscii8",
"armscii8_bin": "armscii8", "armscii8_bin": "armscii8",
"utf8_general_ci": "utf8", "utf8_general_ci": "utf8",
"utf8mb3_general_ci": "utf8mb3",
"utf8_bin": "utf8", "utf8_bin": "utf8",
"utf8_unicode_ci": "utf8", "utf8_unicode_ci": "utf8",
"utf8_icelandic_ci": "utf8", "utf8_icelandic_ci": "utf8",

View File

@ -29,8 +29,8 @@ class MySQLSchema(models.DatastoreSchema):
"""Represents a MySQL database and its properties.""" """Represents a MySQL database and its properties."""
# Defaults # Defaults
__charset__ = "utf8" __charset__ = "utf8mb3"
__collation__ = "utf8_general_ci" __collation__ = "utf8mb3_general_ci"
dbname = re.compile(r"^[A-Za-z0-9_-]+[\s\?\#\@]*[A-Za-z0-9_-]+$") dbname = re.compile(r"^[A-Za-z0-9_-]+[\s\?\#\@]*[A-Za-z0-9_-]+$")
# Complete list of acceptable values # Complete list of acceptable values

View File

@ -1093,8 +1093,8 @@ class TestInstanceMgmtInfo(object):
'databases': [ 'databases': [
{ {
'name': 'db2', 'name': 'db2',
'character_set': 'utf8', 'character_set': 'utf8mb3',
'collate': 'utf8_general_ci', 'collate': 'utf8mb3_general_ci',
}, },
{ {
'name': 'firstdb', 'name': 'firstdb',