Skip to content

Commit

Permalink
Fixed DB migration from alpha-31 to alpha-32
Browse files Browse the repository at this point in the history
Unused/old settings would be removed but then one of those would be used in the next migration.
  • Loading branch information
Casvt committed Jan 17, 2025
1 parent 48ac815 commit b19e5e0
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions backend/internals/db_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,21 +955,6 @@ class MigrateRemoveUnusedSettings(DBMigrator):

def run(self) -> None:
# V30 -> V31

from backend.internals.db import get_db
from backend.internals.settings import SettingsValues

cursor = get_db()
cursor.execute("SELECT key FROM config")
delete_keys = [
key
for key in cursor
if key[0] not in SettingsValues.__dataclass_fields__
]
cursor.executemany(
"DELETE FROM config WHERE key = ?;",
delete_keys
)
return


Expand All @@ -984,9 +969,9 @@ def run(self) -> None:

cursor = get_db()

volume_as_empty = cursor.execute(
volume_as_empty = (cursor.execute(
"SELECT value FROM config WHERE key = 'volume_as_empty' LIMIT 1;"
).fetchone()[0]
).fetchone() or (None,))[0]
if volume_as_empty:
cursor.execute(
"UPDATE config SET value = ? WHERE key = 'file_naming_vai';",
Expand Down

0 comments on commit b19e5e0

Please sign in to comment.