add migration for icons with typo in it (#3478)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-07-04 06:51:17 +05:00 committed by GitHub
parent 2869a8e189
commit 352404533b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,10 +76,21 @@ async function createDefaults (tx: TxOperations): Promise<void> {
)
}
async function fixProjectIcons (tx: TxOperations): Promise<void> {
// @ts-expect-error
const projectsWithWrongIcon = await tx.findAll(tracker.class.Project, { icon: 'tracker:component:IconWithEmojii' })
const promises = []
for (const project of projectsWithWrongIcon) {
promises.push(tx.update(project, { icon: tracker.component.IconWithEmoji }))
}
await Promise.all(promises)
}
export const trackerOperation: MigrateOperation = {
async migrate (client: MigrationClient): Promise<void> {},
async upgrade (client: MigrationUpgradeClient): Promise<void> {
const tx = new TxOperations(client, core.account.System)
await createDefaults(tx)
await fixProjectIcons(tx)
}
}