import logging from logging import Logger from libbot.utils import config_set, config_delete from mongodb_migrations.base import BaseMigration logger: Logger = logging.getLogger(__name__) class Migration(BaseMigration): def upgrade(self): try: config_set("prefix", None, "cache", "memcached") config_set("prefix", None, "cache", "redis") except Exception as exc: logger.error( "Could not upgrade the config during migration '%s' due to: %s", __name__, exc, ) def downgrade(self): try: config_delete("prefix", "cache", "redis") config_delete("prefix", "cache", "memcached") except Exception as exc: logger.error( "Could not downgrade the config during migration '%s' due to: %s", __name__, exc, )