From a42d4aea2f21d6d6096e0b200a9e9665a941f166 Mon Sep 17 00:00:00 2001 From: Denis Bykhov Date: Sun, 30 Nov 2025 17:38:30 +0500 Subject: [PATCH] Fix types role migration Signed-off-by: Denis Bykhov --- models/card/src/migration.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/models/card/src/migration.ts b/models/card/src/migration.ts index 4cd6e2c0df..52488014ee 100644 --- a/models/card/src/migration.ts +++ b/models/card/src/migration.ts @@ -105,6 +105,11 @@ export const cardOperation: MigrateOperation = { state: 'migrate-role-types', mode: 'upgrade', func: migrateRoleTypes + }, + { + state: 'fix-migrated-roles-permissions', + mode: 'upgrade', + func: migrateRolePermissions } ]) } @@ -399,3 +404,11 @@ async function migrateRoleTypes (client: Client): Promise { await txOp.update(role, baseRoleData) } } + +async function migrateRolePermissions (client: Client): Promise { + const txOp = new TxOperations(client, core.account.System) + const roles = await client.findAll(card.class.Role, { permissions: { $exists: false } }) + for (const role of roles) { + await txOp.update(role, { permissions: [] }) + } +}