Database: use schema_version and application_id

This commit is contained in:
2023-09-17 18:58:11 +02:00
parent eac0f4f6a9
commit 5249b7a054
4 changed files with 9 additions and 10 deletions

View File

@ -117,6 +117,7 @@ def main() -> None:
with open(file_name, encoding='utf-8') as sql_file:
print(f'Executing {file_name}')
cnx.executescript(sql_file.read())
ver = cnx.execute("PRAGMA schema_version").fetchall()[0][0]
try:
cnx.isolation_level = None
@ -129,6 +130,7 @@ def main() -> None:
raise RuntimeError('foreign key constraint failed')
cnx.execute("COMMIT")
cnx.execute("VACUUM")
cnx.execute(f"PRAGMA schema_version = {ver}")
except Exception as err:
cnx.execute("ROLLBACK")
raise err