home · contact · privacy
Minor code refactoring, and fix default DB path back from debugging assumption.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 6 Jan 2025 16:49:07 +0000 (17:49 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 6 Jan 2025 16:49:07 +0000 (17:49 +0100)
src/ytplom/db.py

index d96a7ab48dc812156827ae9200520a3e60bd64f3..b330d7e172baea9b70c8a5c44303e4b9c191b98e 100644 (file)
@@ -14,7 +14,7 @@ from ytplom.primitives import (
 
 
 EXPECTED_DB_VERSION = 6
-PATH_DB = PATH_APP_DATA.joinpath('TESTdb.sql')
+PATH_DB = PATH_APP_DATA.joinpath('db.sql')
 
 SqlText = NewType('SqlText', str)
 
@@ -110,8 +110,7 @@ class DbFile:
                 row_normed[-2:] = [indent + row_normed[-1][:-1]] + [')']
             schema_rows_normed += ['\n'.join(row_normed)]
         retrieved_schema = ';\n'.join(schema_rows_normed) + ';'
-        with open(_PATH_DB_SCHEMA, 'r', encoding='utf-8') as f:
-            stored_schema = f.read().rstrip()
+        stored_schema = _PATH_DB_SCHEMA.read_text(encoding='utf-8').rstrip()
         if stored_schema != retrieved_schema:
             diff_msg = Differ().compare(retrieved_schema.splitlines(),
                                         stored_schema.splitlines())