Added migration only mode #240
This commit is contained in:
parent
a510cf731f
commit
f03416d05f
@ -1,3 +1,4 @@
|
|||||||
|
import sys
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from cpl_core.application.application_extension_abc import ApplicationExtensionABC
|
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.configuration.feature_flags_settings import FeatureFlagsSettings
|
||||||
from bot_core.logging.database_logger import DatabaseLogger
|
from bot_core.logging.database_logger import DatabaseLogger
|
||||||
from bot_data.service.migration_service import MigrationService
|
from bot_data.service.migration_service import MigrationService
|
||||||
from bot_data.service.seeder_service import SeederService
|
|
||||||
|
|
||||||
|
|
||||||
class DatabaseExtension(ApplicationExtensionABC):
|
class DatabaseExtension(ApplicationExtensionABC):
|
||||||
@ -25,3 +25,6 @@ class DatabaseExtension(ApplicationExtensionABC):
|
|||||||
config.add_configuration("Database_StartTime", str(datetime.now()))
|
config.add_configuration("Database_StartTime", str(datetime.now()))
|
||||||
migrations: MigrationService = services.get_service(MigrationService)
|
migrations: MigrationService = services.get_service(MigrationService)
|
||||||
migrations.migrate()
|
migrations.migrate()
|
||||||
|
if config.get_configuration("MIGRATION_ONLY"):
|
||||||
|
logger.warn(__name__, "Migrations finished. Stopping application...")
|
||||||
|
sys.exit()
|
||||||
|
Loading…
Reference in New Issue
Block a user