Skip to content

Commit 9213dd0

Browse files
committed
Fix upgrade index
1 parent 3427283 commit 9213dd0

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

mautrix/crypto/store/asyncpg/upgrade.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,17 @@ async def upgrade_v9(conn: Connection, scheme: Scheme) -> None:
267267
await upgrade_v9_sqlite(conn)
268268

269269

270+
# These two are never used because the previous one jumps from 6 to 9.
271+
@upgrade_table.register
272+
async def upgrade_noop_7_to_8(_: Connection) -> None:
273+
pass
274+
275+
276+
@upgrade_table.register
277+
async def upgrade_noop_8_to_9(_: Connection) -> None:
278+
pass
279+
280+
270281
async def upgrade_v9_postgres(conn: Connection) -> None:
271282
await conn.execute("UPDATE crypto_account SET device_id='' WHERE device_id IS NULL")
272283
await conn.execute("ALTER TABLE crypto_account ALTER COLUMN device_id SET NOT NULL")

mautrix/util/async_db/upgrade.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
UpgradeWithoutScheme = Callable[[LoggingConnection], Awaitable[Optional[int]]]
2222

2323

24-
async def noop_upgrade(_: LoggingConnection) -> None:
24+
async def noop_upgrade(_: LoggingConnection, _2: Scheme) -> None:
2525
pass
2626

2727

@@ -178,6 +178,6 @@ def _find_upgrade_table(fn: Upgrade) -> UpgradeTable:
178178

179179
def register_upgrade(index: int = -1, description: str = "") -> Callable[[Upgrade], Upgrade]:
180180
def actually_register(fn: Upgrade) -> Upgrade:
181-
return _find_upgrade_table(fn).register(index, description, fn)
181+
return _find_upgrade_table(fn).register(fn, index=index, description=description)
182182

183183
return actually_register

0 commit comments

Comments
 (0)