chore: made knex orm query to raw sql query

This commit is contained in:
Piyush Gupta
2025-11-21 00:27:49 +05:30
parent c467e91377
commit 8e6733d42c
@@ -14,13 +14,16 @@ export async function up(knex: Knex): Promise<void> {
if (rows.length > 0) { if (rows.length > 0) {
for (let i = 0; i < rows.length; i += BATCH_SIZE) { for (let i = 0; i < rows.length; i += BATCH_SIZE) {
const batch = rows.slice(i, i + BATCH_SIZE); const batch = rows.slice(i, i + BATCH_SIZE);
const ids = batch.map((row) => row.id);
// eslint-disable-next-line no-await-in-loop // eslint-disable-next-line no-await-in-loop
await knex(TableName.SecretApprovalPolicy) await knex.raw(
.whereIn( `
"id", UPDATE ??
batch.map((row) => row.id) SET ?? = true
) WHERE ?? IN (${ids.map(() => "?").join(",")})
.update({ shouldCheckSecretPermission: true }); `,
[TableName.SecretApprovalPolicy, "shouldCheckSecretPermission", "id", ids]
);
} }
} }
} }