mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-22 19:34:18 +01:00
no backup (#423)
This commit is contained in:
@@ -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():
|
||||||
|
|||||||
Reference in New Issue
Block a user