Removed old logic #428

This commit is contained in:
Sven Heidemann 2023-11-13 22:57:17 +01:00
parent d2d59bdad7
commit e01c738cf0

View File

@ -23,10 +23,6 @@ class MigrationService:
self._db = db
self._cursor = db.cursor
# self._migrations: List[MigrationABC] = (
# List(type, MigrationABC.__subclasses__()).order_by(lambda x: x.name.split("_")[0]).then_by(lambda x: x.prio)
# )
def _migrate_from_old_to_new(self):
results = self._db.select(
"""
@ -111,30 +107,3 @@ class MigrationService:
def migrate(self):
self._migrate_from_old_to_new()
self._execute(self._load_up_scripts())
# def migrate(self):
# self._logger.info(__name__, f"Running Migrations")
# for migration in self._migrations:
# migration_id = migration.__name__
# try:
# # check if table exists
# self._cursor.execute("SHOW TABLES LIKE 'MigrationHistory'")
# result = self._cursor.fetchone()
# if result:
# # there is a table named "tableName"
# self._logger.trace(
# __name__,
# f"Running SQL Command: {MigrationHistory.get_select_by_id_string(migration_id)}",
# )
# migration_from_db = self._db.select(MigrationHistory.get_select_by_id_string(migration_id))
# if migration_from_db is not None and len(migration_from_db) > 0:
# continue
#
# self._logger.debug(__name__, f"Running Migration {migration_id}")
# migration_as_service: MigrationABC = self._services.get_service(migration)
# migration_as_service.upgrade()
# self._cursor.execute(MigrationHistory(migration_id).insert_string)
# self._db.save_changes()
#
# except Exception as e:
# self._logger.error(__name__, f"Cannot get migration with id {migration}", e)