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

View File

@@ -14,13 +14,16 @@ export async function up(knex: Knex): Promise<void> {
if (rows.length > 0) {
for (let i = 0; i < rows.length; 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
await knex(TableName.SecretApprovalPolicy)
.whereIn(
"id",
batch.map((row) => row.id)
)
.update({ shouldCheckSecretPermission: true });
await knex.raw(
`
UPDATE ??
SET ?? = true
WHERE ?? IN (${ids.map(() => "?").join(",")})
`,
[TableName.SecretApprovalPolicy, "shouldCheckSecretPermission", "id", ids]
);
}
}
}