mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-30 14:12:28 +00:00
Fix SQLite support
This commit is contained in:
parent
9236136f3a
commit
e24c32e6f3
@ -365,7 +365,9 @@ def setup(config_options):
|
|||||||
else:
|
else:
|
||||||
db_config = {
|
db_config = {
|
||||||
"name": "sqlite3",
|
"name": "sqlite3",
|
||||||
|
"args": {
|
||||||
"database": config.database_path,
|
"database": config.database_path,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
db_config = {
|
db_config = {
|
||||||
@ -381,10 +383,12 @@ def setup(config_options):
|
|||||||
"use_unicode": True,
|
"use_unicode": True,
|
||||||
})
|
})
|
||||||
elif name == "sqlite3":
|
elif name == "sqlite3":
|
||||||
|
def open_fun(conn):
|
||||||
|
prepare_database(conn, database_engine)
|
||||||
db_config.setdefault("args", {}).update({
|
db_config.setdefault("args", {}).update({
|
||||||
"cp_min": 1,
|
"cp_min": 1,
|
||||||
"cp_max": 1,
|
"cp_max": 1,
|
||||||
"cp_openfun": prepare_database,
|
"cp_openfun": open_fun,
|
||||||
})
|
})
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Unsupported database type '%s'" % (name,))
|
raise RuntimeError("Unsupported database type '%s'" % (name,))
|
||||||
@ -413,7 +417,12 @@ def setup(config_options):
|
|||||||
logger.info("Preparing database: %s...", db_name)
|
logger.info("Preparing database: %s...", db_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db_conn = database_engine.module.connect(**db_config.get("args", {}))
|
db_conn = database_engine.module.connect(
|
||||||
|
**{
|
||||||
|
k: v for k, v in db_config.get("args", {}).items()
|
||||||
|
if not k.startswith("cp_")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
if name == "sqlite3":
|
if name == "sqlite3":
|
||||||
prepare_sqlite3_database(db_conn)
|
prepare_sqlite3_database(db_conn)
|
||||||
|
Loading…
Reference in New Issue
Block a user