Skip to content
Snippets Groups Projects
Unverified Commit eee3c3c5 authored by Erik Johnston's avatar Erik Johnston Committed by GitHub
Browse files

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.
parent 1b4d5d6a
No related branches found
No related tags found
No related merge requests found
Allow bumping schema version when using split out state database.
...@@ -375,7 +375,16 @@ def _upgrade_existing_database( ...@@ -375,7 +375,16 @@ 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):
logger.info("Applying schema deltas for v%d", v) if not is_worker:
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( ...@@ -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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment