mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 10:26:06 -04:00
Add database config class (#6513)
This encapsulates config for a given database and is the way to get new connections.
This commit is contained in:
parent
91ccfe9f37
commit
2284eb3a53
19 changed files with 286 additions and 208 deletions
|
@ -41,7 +41,7 @@ class UpgradeDatabaseException(PrepareDatabaseException):
|
|||
pass
|
||||
|
||||
|
||||
def prepare_database(db_conn, database_engine, config):
|
||||
def prepare_database(db_conn, database_engine, config, data_stores=["main"]):
|
||||
"""Prepares a database for usage. Will either create all necessary tables
|
||||
or upgrade from an older schema version.
|
||||
|
||||
|
@ -54,11 +54,10 @@ def prepare_database(db_conn, database_engine, config):
|
|||
config (synapse.config.homeserver.HomeServerConfig|None):
|
||||
application config, or None if we are connecting to an existing
|
||||
database which we expect to be configured already
|
||||
data_stores (list[str]): The name of the data stores that will be used
|
||||
with this database. Defaults to all data stores.
|
||||
"""
|
||||
|
||||
# For now we only have the one datastore.
|
||||
data_stores = ["main"]
|
||||
|
||||
try:
|
||||
cur = db_conn.cursor()
|
||||
version_info = _get_or_create_schema_state(cur, database_engine)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue