summary refs log tree commit diff
path: root/synapse/app
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-02 10:06:22 +0100
committerErik Johnston <erik@matrix.org>2015-04-02 10:06:22 +0100
commit779f7b0f443bfab351702161763b62b7bb6a27d8 (patch)
tree43729d7eb2030bf124ca0d8fa742ffa056bdb79f /synapse/app
parentFix SQLite support (diff)
downloadsynapse-779f7b0f443bfab351702161763b62b7bb6a27d8.tar.xz
Fix unicode support
Diffstat (limited to 'synapse/app')
-rwxr-xr-xsynapse/app/homeserver.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/synapse/app/homeserver.py b/synapse/app/homeserver.py
index 1ab6effd5f..9d7a58080d 100755
--- a/synapse/app/homeserver.py
+++ b/synapse/app/homeserver.py
@@ -18,7 +18,7 @@ import sys
 sys.dont_write_bytecode = True
 
 from synapse.storage import (
-    prepare_database, prepare_sqlite3_database, UpgradeDatabaseException,
+    prepare_database, UpgradeDatabaseException,
 )
 from synapse.storage.engines import create_engine
 
@@ -381,19 +381,18 @@ def setup(config_options):
             "sql_mode": "TRADITIONAL",
             "charset": "utf8mb4",
             "use_unicode": True,
+            "collation": "utf8mb4_general_ci",
         })
     elif name == "sqlite3":
-        def open_fun(conn):
-            prepare_database(conn, database_engine)
         db_config.setdefault("args", {}).update({
             "cp_min": 1,
             "cp_max": 1,
-            "cp_openfun": open_fun,
         })
     else:
         raise RuntimeError("Unsupported database type '%s'" % (name,))
 
     database_engine = create_engine(name)
+    db_config["args"]["cp_openfun"] = database_engine.on_new_connection
 
     hs = SynapseHomeServer(
         config.server_name,
@@ -424,10 +423,7 @@ def setup(config_options):
             }
         )
 
-        if name == "sqlite3":
-            prepare_sqlite3_database(db_conn)
-
-        prepare_database(db_conn, database_engine)
+        database_engine.prepare_database(db_conn)
 
         db_conn.commit()
     except UpgradeDatabaseException: