Added migration for config in wi #127

This commit is contained in:
2023-07-19 10:49:37 +02:00
parent a482c72a56
commit 05a2ea9b18
6 changed files with 93 additions and 1 deletions

View File

@@ -0,0 +1,33 @@
from bot_core.logging.database_logger import DatabaseLogger
from bot_data.abc.migration_abc import MigrationABC
from bot_data.db_context import DBContext
class ConfigMigration(MigrationABC):
name = "1.1.0_ConfigMigration"
def __init__(self, logger: DatabaseLogger, db: DBContext):
MigrationABC.__init__(self)
self._logger = logger
self._db = db
self._cursor = db.cursor
def upgrade(self):
self._logger.debug(__name__, "Running upgrade")
# self._cursor.execute(
# str(
# f"""
# CREATE TABLE IF NOT EXISTS `Config` (
# `Id` BIGINT NOT NULL AUTO_INCREMENT,
# `CreatedAt` DATETIME(6),
# `LastModifiedAt` DATETIME(6),
# PRIMARY KEY(`Id`)
# );
# """
# )
# )
def downgrade(self):
self._logger.debug(__name__, "Running downgrade")
# self._cursor.execute("DROP TABLE `Config`;")