summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2022-01-25 14:11:13 +0000
committerGitHub <noreply@github.com>2022-01-25 14:11:13 +0000
commitfc8598bc87d5bcc7e8526492f309e73c8dcff3f6 (patch)
tree7903f0c7ddb849ef120ed384cb92e7a4aa214630 /synapse
parentDocs: add missing PR submission process how-tos (#11821) (diff)
downloadsynapse-fc8598bc87d5bcc7e8526492f309e73c8dcff3f6.tar.xz
Minor updates, and docs, for schema delta files (#11823)
* Make functions in python deltas optional

It's annoying to always have to write stubs for these.

* Documentation for delta files

* changelog
Diffstat (limited to 'synapse')
-rw-r--r--synapse/storage/prepare_database.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/synapse/storage/prepare_database.py b/synapse/storage/prepare_database.py

index 1823e18720..e3153d1a4a 100644 --- a/synapse/storage/prepare_database.py +++ b/synapse/storage/prepare_database.py
@@ -499,9 +499,12 @@ def _upgrade_existing_database( module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) # type: ignore - logger.info("Running script %s", relative_path) - module.run_create(cur, database_engine) # type: ignore - if not is_empty: + if hasattr(module, "run_create"): + logger.info("Running %s:run_create", relative_path) + module.run_create(cur, database_engine) # type: ignore + + if not is_empty and hasattr(module, "run_upgrade"): + logger.info("Running %s:run_upgrade", relative_path) module.run_upgrade(cur, database_engine, config=config) # type: ignore elif ext == ".pyc" or file_name == "__pycache__": # Sometimes .pyc files turn up anyway even though we've