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
|
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``
|
Adress to the list of ``valid_oauth_clients``. Then in the ``database``
|
||||||
section, on the line which reads
|
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
|
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 ``#``.
|
steps). On both of these lines you will need to remove the ``#``.
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ lock_path = $state_path/lock
|
|||||||
[database]
|
[database]
|
||||||
# This line MUST be changed to actually run storyboard
|
# This line MUST be changed to actually run storyboard
|
||||||
# Example:
|
# 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
|
# 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.)
|
# main storyboard server. (Leave it as is if the database runs on this host.)
|
||||||
# connection=sqlite://
|
# connection=sqlite://
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
lock_path = $state_path/lock
|
lock_path = $state_path/lock
|
||||||
|
|
||||||
[database]
|
[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 = "storyboard_test_db_%s" % uuid.uuid4()
|
||||||
self.db_name = self.db_name.replace("-", "_")
|
self.db_name = self.db_name.replace("-", "_")
|
||||||
CONF.set_override(
|
dburi = self.test_connection + "/%s" % self.db_name
|
||||||
"connection",
|
if dburi.startswith('mysql+pymysql://'):
|
||||||
self.test_connection + "/%s"
|
dburi += "?charset=utf8mb4"
|
||||||
% self.db_name,
|
CONF.set_override("connection", dburi, group="database")
|
||||||
group="database")
|
|
||||||
self._full_db_name = self.test_connection + '/' + self.db_name
|
self._full_db_name = self.test_connection + '/' + self.db_name
|
||||||
LOG.info('using database %s', CONF.database.connection)
|
LOG.info('using database %s', CONF.database.connection)
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#sqlite=sqlite://
|
#sqlite=sqlite://
|
||||||
#sqlitefile=sqlite:///test_migrations_utils.db
|
#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_dbs]
|
||||||
# Migration DB details are listed separately as they can't be connected to
|
# 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://
|
#sqlite=sqlite://
|
||||||
#sqlitefile=sqlite:///test_migrations.db
|
#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]
|
[walk_style]
|
||||||
snake_walk=yes
|
snake_walk=yes
|
||||||
|
Loading…
x
Reference in New Issue
Block a user