mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-09-09 12:51:56 +00:00
Handle updating schema version without any deltas. (#9033)
This can happen when using a split out state database and we've upgraded the schema version without there being any changes in the state schema.
This commit is contained in:
parent
1b4d5d6acf
commit
eee3c3c52f
1
changelog.d/9033.misc
Normal file
1
changelog.d/9033.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Allow bumping schema version when using split out state database.
|
@ -375,8 +375,17 @@ def _upgrade_existing_database(
|
|||||||
specific_engine_extensions = (".sqlite", ".postgres")
|
specific_engine_extensions = (".sqlite", ".postgres")
|
||||||
|
|
||||||
for v in range(start_ver, SCHEMA_VERSION + 1):
|
for v in range(start_ver, SCHEMA_VERSION + 1):
|
||||||
|
if not is_worker:
|
||||||
logger.info("Applying schema deltas for v%d", v)
|
logger.info("Applying schema deltas for v%d", v)
|
||||||
|
|
||||||
|
cur.execute("DELETE FROM schema_version")
|
||||||
|
cur.execute(
|
||||||
|
"INSERT INTO schema_version (version, upgraded) VALUES (?,?)",
|
||||||
|
(v, True),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logger.info("Checking schema deltas for v%d", v)
|
||||||
|
|
||||||
# We need to search both the global and per data store schema
|
# We need to search both the global and per data store schema
|
||||||
# directories for schema updates.
|
# directories for schema updates.
|
||||||
|
|
||||||
@ -489,12 +498,6 @@ def _upgrade_existing_database(
|
|||||||
(v, relative_path),
|
(v, relative_path),
|
||||||
)
|
)
|
||||||
|
|
||||||
cur.execute("DELETE FROM schema_version")
|
|
||||||
cur.execute(
|
|
||||||
"INSERT INTO schema_version (version, upgraded) VALUES (?,?)",
|
|
||||||
(v, True),
|
|
||||||
)
|
|
||||||
|
|
||||||
logger.info("Schema now up to date")
|
logger.info("Schema now up to date")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user