Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions compliance-monitor/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,13 @@ def db_upgrade_schema(conn: connection, cur: cursor):
# that way just in case we want to use another database at some point
while True:
current = db_get_schema_version(cur)
if current >= SCHEMA_VERSIONS[-1]: # bail if version is too new (but hope it's compatible)
break
if current is None:
# this is an empty db, but it also used to be the case with v1
# I (mbuechse) made sure manually that the value v1 is set on running installations
db_ensure_schema_v4(cur)
db_set_schema_version(cur, 'v4')
conn.commit()
break # Nothing more to do, we bootstrapped with the latest schema version
elif current == 'v1':
db_ensure_schema_v2(cur)
db_upgrade_data_v1_v2(cur)
Expand All @@ -219,6 +218,8 @@ def db_upgrade_schema(conn: connection, cur: cursor):
db_ensure_schema_v4(cur)
db_set_schema_version(cur, 'v4')
conn.commit()
elif current >= SCHEMA_VERSIONS[-1]: # bail if version is too new (but hope it's compatible)
break


def db_ensure_schema(conn: connection):
Expand Down
Loading