fix(migrate): move ownerId fix before federated_id backfill

The federated_id backfill queries WHERE owner_id IS NULL. If the
ownerId fix runs after it, broken 1-on-1 DMs would be skipped.
This commit is contained in:
Jannis Braun
2026-03-26 22:21:03 +01:00
parent bec4c2446f
commit 37e2399647
+3 -2
View File
@@ -497,6 +497,9 @@ export function runMigrations(db: Database.Database): void {
// ─── Rename canonical_pair_id → federated_id, add group DM columns ───────
migrateDmChannelsFederatedId(db);
// ─── Fix ownerId on 1-on-1 DMs (must run before federated_id backfill) ──
migrateFixOneOnOneOwnerIds(db);
// ─── Backfill federated_id for existing 1-on-1 DM channels ──────────────
// (Runs after migrateDmChannelsFederatedId so the federated_id column is guaranteed to exist)
try {
@@ -607,8 +610,6 @@ export function runMigrations(db: Database.Database): void {
console.error('Federation mutation log backfill failed (non-fatal):', err);
}
migrateFixOneOnOneOwnerIds(db);
console.log('Migrations complete.');
}