allow communties without users for migrate

This commit is contained in:
einhornimmond 2025-11-14 16:43:52 +01:00
parent 0d8c5d2d19
commit 087a1f1070
2 changed files with 6 additions and 3 deletions

View File

@ -42,8 +42,11 @@ async function bootstrapCommunities(context: Context): Promise<Map<string, Commu
})
generateKeyPairCommunity(communityDb, context.cache, topicId)
// create community root transaction 1 minute before first user
const creationDate = new Date(new Date(communityDb.userMinCreatedAt).getTime() - 1000 * 60)
let creationDate = communityDb.creationDate
if (communityDb.userMinCreatedAt && communityDb.userMinCreatedAt < communityDb.creationDate) {
// create community root transaction 1 minute before first user
creationDate = new Date(new Date(communityDb.userMinCreatedAt).getTime() - 1000 * 60)
}
// community from db to community format the dlt connector normally uses
const community = communityDbToCommunity(topicId, communityDb, creationDate)
await addCommunityRootTransaction(blockchain, community)

View File

@ -46,7 +46,7 @@ export const communityDbSchema = v.object({
communityUuid: uuidv4Schema,
name: v.string(),
creationDate: dateSchema,
userMinCreatedAt: dateSchema,
userMinCreatedAt: v.nullish(dateSchema),
uniqueAlias: v.string(),
})