mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 04:53:01 +00:00
combine userdata and swing db into one
+ port populate to new db interface
+ add genrehashes and hash info to tracks
+ properly structure new db table files
+ move helpers to dedicated utils file
+ move settings from db to config file
+ move artists, albums, auth and favorites endpoint to new db interface
+ use folder store to index filepaths
+ paginate favorite pages
+ 56 moretiny changes 😅
This commit is contained in:
+20
-15
@@ -7,7 +7,9 @@ Reads and applies the latest database migrations.
|
||||
import inspect
|
||||
import sys
|
||||
from types import ModuleType
|
||||
from app.db.sqlite.migrations import MigrationManager
|
||||
|
||||
# from app.db.sqlite.migrations import MigrationManager
|
||||
from app.db.metadata import MigrationTable
|
||||
from app.logger import log
|
||||
from app.migrations import v1_3_0, v1_4_9
|
||||
from app.migrations.base import Migration
|
||||
@@ -42,26 +44,29 @@ def apply_migrations():
|
||||
modules = [v1_3_0, v1_4_9]
|
||||
migrations = [get_all_migrations(m) for m in modules]
|
||||
|
||||
index = MigrationManager.get_index()
|
||||
# index = MigrationManager.get_index()
|
||||
index = MigrationTable.get_version()
|
||||
all_migrations = [migration for sublist in migrations for migration in sublist]
|
||||
|
||||
to_apply: list[Migration] = []
|
||||
|
||||
# if index is from old release,
|
||||
# get migrations from the "migrations" list
|
||||
if index < 3:
|
||||
_migrations = migrations[index:]
|
||||
to_apply = [migration for sublist in _migrations for migration in sublist]
|
||||
else:
|
||||
to_apply = all_migrations[index:]
|
||||
|
||||
# if index < 3:
|
||||
# _migrations = migrations[index:]
|
||||
# to_apply = [migration for sublist in _migrations for migration in sublist]
|
||||
# else:
|
||||
# to_apply = all_migrations[index:]
|
||||
|
||||
for migration in to_apply:
|
||||
# try:
|
||||
migration.migrate()
|
||||
log.info("Applied migration: %s", migration.__name__)
|
||||
# except Exception as e:
|
||||
# log.error("Failed to run migration: %s", migration.__name__)
|
||||
# log.error(e)
|
||||
# for migration in to_apply:
|
||||
# # try:
|
||||
# migration.migrate()
|
||||
# log.info("Applied migration: %s", migration.__name__)
|
||||
# except Exception as e:
|
||||
# log.error("Failed to run migration: %s", migration.__name__)
|
||||
# log.error(e)
|
||||
|
||||
# sys.exit(0)
|
||||
MigrationManager.set_index(len(all_migrations))
|
||||
# MigrationManager.set_index(len(all_migrations))
|
||||
MigrationTable.set_version(len(all_migrations))
|
||||
|
||||
Reference in New Issue
Block a user