Use charset=utf8mb4 in pymysql DBURIs
To make full use of the new 4-byte character set in columns for MySQL, connections to the database need to also specify charset=utf8mb4. The easiest way to do that is by tacking it on as a variable in the DBURI string. Do this both in the test migration script and in the documented sample and test configs. Change-Id: Icf5f74543f6d062cafe2166d384f37f46394e964
This commit is contained in:
parent
27b208b8a6
commit
2c64cee9f3
@ -69,7 +69,7 @@ Installing and Upgrading the API server
|
||||
5. Edit ``./etc/storyboard.conf`` and in the ``oauth`` section, add your IP
|
||||
Adress to the list of ``valid_oauth_clients``. Then in the ``database``
|
||||
section, on the line which reads
|
||||
``# connection = mysql+pymysql://root:pass@127.0.0.1:3306/storyboard``,
|
||||
``# connection = mysql+pymysql://root:pass@127.0.0.1:3306/storyboard?charset=utf8mb4``,
|
||||
replace the ``pass`` with your password (the same as used in the above
|
||||
steps). On both of these lines you will need to remove the ``#``.
|
||||
|
||||
|
@ -116,7 +116,7 @@ lock_path = $state_path/lock
|
||||
[database]
|
||||
# This line MUST be changed to actually run storyboard
|
||||
# Example:
|
||||
# connection = mysql+pymysql://root:pass@127.0.0.1:3306/storyboard
|
||||
# connection = mysql+pymysql://root:pass@127.0.0.1:3306/storyboard?charset=utf8mb4
|
||||
# Replace 127.0.0.1 above with the IP address of the database used by the
|
||||
# main storyboard server. (Leave it as is if the database runs on this host.)
|
||||
# connection=sqlite://
|
||||
|
@ -9,4 +9,4 @@
|
||||
lock_path = $state_path/lock
|
||||
|
||||
[database]
|
||||
connection = mysql+pymysql://#DB_USER#:#DB_PASSWORD#@127.0.0.1:3306/#DB_TEST#
|
||||
connection = mysql+pymysql://#DB_USER#:#DB_PASSWORD#@127.0.0.1:3306/#DB_TEST#?charset=utf8mb4
|
||||
|
@ -146,11 +146,10 @@ class DbTestCase(WorkingDirTestCase):
|
||||
|
||||
self.db_name = "storyboard_test_db_%s" % uuid.uuid4()
|
||||
self.db_name = self.db_name.replace("-", "_")
|
||||
CONF.set_override(
|
||||
"connection",
|
||||
self.test_connection + "/%s"
|
||||
% self.db_name,
|
||||
group="database")
|
||||
dburi = self.test_connection + "/%s" % self.db_name
|
||||
if dburi.startswith('mysql+pymysql://'):
|
||||
dburi += "?charset=utf8mb4"
|
||||
CONF.set_override("connection", dburi, group="database")
|
||||
self._full_db_name = self.test_connection + '/' + self.db_name
|
||||
LOG.info('using database %s', CONF.database.connection)
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#sqlite=sqlite://
|
||||
#sqlitefile=sqlite:///test_migrations_utils.db
|
||||
mysql=mysql+pymysql://storyboard:storyboard@localhost/test_migrations_utils
|
||||
mysql=mysql+pymysql://storyboard:storyboard@localhost/test_migrations_utils?charset=utf8mb4
|
||||
|
||||
[migration_dbs]
|
||||
# Migration DB details are listed separately as they can't be connected to
|
||||
@ -17,7 +17,7 @@ mysql=mysql+pymysql://storyboard:storyboard@localhost/test_migrations_utils
|
||||
|
||||
#sqlite=sqlite://
|
||||
#sqlitefile=sqlite:///test_migrations.db
|
||||
#mysql=mysql+pymysql://user:pass@localhost/test_migrations
|
||||
#mysql=mysql+pymysql://user:pass@localhost/test_migrations?charset=utf8mb4
|
||||
|
||||
[walk_style]
|
||||
snake_walk=yes
|
||||
|
Loading…
x
Reference in New Issue
Block a user