mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-23 22:47:05 +01:00
fix: explicitly specify the DB name when migrating (#2039)
This commit is contained in:
parent
e522a53340
commit
d64e2f42f5
2 changed files with 5 additions and 4 deletions
|
@ -89,7 +89,7 @@ async def migrate_databases():
|
|||
|
||||
current_versions = await get_dbversions(conn)
|
||||
core_version = current_versions.get("core", 0)
|
||||
await run_migration(conn, core_migrations, core_version)
|
||||
await run_migration(conn, core_migrations, "core", core_version)
|
||||
|
||||
for ext in get_valid_extensions():
|
||||
current_version = current_versions.get(ext.code, 0)
|
||||
|
|
|
@ -25,12 +25,13 @@ async def migrate_extension_database(ext: Extension, current_version):
|
|||
)
|
||||
|
||||
async with ext_db.connect() as ext_conn:
|
||||
await run_migration(ext_conn, ext_migrations, current_version)
|
||||
await run_migration(ext_conn, ext_migrations, ext.code, current_version)
|
||||
|
||||
|
||||
async def run_migration(db: Connection, migrations_module: Any, current_version: int):
|
||||
async def run_migration(
|
||||
db: Connection, migrations_module: Any, db_name: str, current_version: int
|
||||
):
|
||||
matcher = re.compile(r"^m(\d\d\d)_")
|
||||
db_name = migrations_module.__name__.split(".")[-2]
|
||||
for key, migrate in migrations_module.__dict__.items():
|
||||
match = matcher.match(key)
|
||||
if match:
|
||||
|
|
Loading…
Add table
Reference in a new issue