Skip to content

Commit db4de1f

Browse files
committed
fix(migration): skip v9.7.5 migration when readers collection does not exist
1 parent fa82f2c commit db4de1f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

apps/core/src/migration/version/v9.7.5.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import { defineMigration } from '../helper'
55
const OWNER_UNIQUE_INDEX = 'readers_owner_unique_role'
66

77
export default defineMigration('v9.7.5-owner-uniqueness', async (db: Db) => {
8+
const collections = await db
9+
.listCollections({ name: AUTH_JS_USER_COLLECTION })
10+
.toArray()
11+
if (collections.length === 0) {
12+
return
13+
}
14+
815
const readers = db.collection(AUTH_JS_USER_COLLECTION)
916

1017
await readers.updateMany(

0 commit comments

Comments
 (0)