From 454fabb3e3d297909d32c5a1c52465ff1c9ca734 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 4 Mar 2023 18:57:51 +0100 Subject: [PATCH] Added migration only mode #240 --- kdb-bot/src/modules/database/database_extension.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kdb-bot/src/modules/database/database_extension.py b/kdb-bot/src/modules/database/database_extension.py index 88682ca0..1c26e70b 100644 --- a/kdb-bot/src/modules/database/database_extension.py +++ b/kdb-bot/src/modules/database/database_extension.py @@ -1,3 +1,4 @@ +import sys from datetime import datetime from cpl_core.application.application_extension_abc import ApplicationExtensionABC @@ -9,7 +10,6 @@ from bot_core.configuration.feature_flags_enum import FeatureFlagsEnum from bot_core.configuration.feature_flags_settings import FeatureFlagsSettings from bot_core.logging.database_logger import DatabaseLogger from bot_data.service.migration_service import MigrationService -from bot_data.service.seeder_service import SeederService class DatabaseExtension(ApplicationExtensionABC): @@ -25,3 +25,6 @@ class DatabaseExtension(ApplicationExtensionABC): config.add_configuration("Database_StartTime", str(datetime.now())) migrations: MigrationService = services.get_service(MigrationService) migrations.migrate() + if config.get_configuration("MIGRATION_ONLY"): + logger.warn(__name__, "Migrations finished. Stopping application...") + sys.exit()