Improved logging for migrations #45

This commit is contained in:
Sven Heidemann 2022-10-02 13:22:41 +02:00
parent e2749f6a81
commit fa50123d3b

View File

@ -31,11 +31,10 @@ class MigrationService:
# there is a table named "tableName" # there is a table named "tableName"
self._logger.trace(__name__, f"Running SQL Command: {MigrationHistory.get_select_by_id_string(migration_id)}") 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)) migration_from_db = self._db.select(MigrationHistory.get_select_by_id_string(migration_id))
self._logger.trace(__name__, str(migration_from_db))
if migration_from_db is not None and len(migration_from_db) > 0: if migration_from_db is not None and len(migration_from_db) > 0:
continue continue
self._logger.debug(__name__, f"Running Migration {migration}") self._logger.debug(__name__, f"Running Migration {migration_id}")
migration_as_service: MigrationABC = self._services.get_service(migration) migration_as_service: MigrationABC = self._services.get_service(migration)
migration_as_service.upgrade() migration_as_service.upgrade()
self._cursor.execute(MigrationHistory(migration_id).insert_string) self._cursor.execute(MigrationHistory(migration_id).insert_string)