no backup (#423)

This commit is contained in:
callebtc
2024-02-15 14:01:06 +01:00
committed by GitHub
parent d168b4b516
commit e251e8a9ea

View File

@@ -56,18 +56,12 @@ async def migrate_databases(db: Database, migrations_module):
async def run_migration(db, migrations_module): async def run_migration(db, migrations_module):
db_name = migrations_module.__name__.split(".")[-2] db_name = migrations_module.__name__.split(".")[-2]
# we first check whether any migration is needed and create a backup if so # we first check whether any migration is needed and create a backup if so
migration_needed = False
for key, migrate in migrations_module.__dict__.items(): for key, migrate in migrations_module.__dict__.items():
match = matcher.match(key) match = matcher.match(key)
if match: if match:
version = int(match.group(1)) version = int(match.group(1))
if version > current_versions.get(db_name, 0): if version > current_versions.get(db_name, 0):
migration_needed = True
break break
if migration_needed and settings.db_backup_path:
logger.debug(f"Creating backup of {db_name} db")
current_version = current_versions.get(db_name, 0)
await backup_database(db, current_version)
# then we run the migrations # then we run the migrations
for key, migrate in migrations_module.__dict__.items(): for key, migrate in migrations_module.__dict__.items():