Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(pki): use a raw statement for the extended key usage backfill

Claudeecd6fdc01b2c
diff --git a/backend/src/db/migrations/20260831165247_certificates-remove-null-extended-key-usages.ts b/backend/src/db/migrations/20260831165247_certificates-remove-null-extended-key-usages.ts
index 38abc1094d..b9332c46e0 100644
--- a/backend/src/db/migrations/20260831165247_certificates-remove-null-extended-key-usages.ts
+++ b/backend/src/db/migrations/20260831165247_certificates-remove-null-extended-key-usages.ts
@@ -3,13 +3,11 @@ import { Knex } from "knex";
import { TableName } from "../schemas";
export async function up(knex: Knex): Promise<void> {
- if (await knex.schema.hasColumn(TableName.Certificate, "extendedKeyUsages")) {
- await knex(TableName.Certificate)
- .whereRaw(`array_position("extendedKeyUsages", NULL::text) IS NOT NULL`)
- .update({
- extendedKeyUsages: knex.raw(`array_remove("extendedKeyUsages", NULL::text)`)
- });
- }
+ if (!(await knex.schema.hasColumn(TableName.Certificate, "extendedKeyUsages"))) return;
+
+ await knex.raw(
+ `UPDATE "${TableName.Certificate}" SET "extendedKeyUsages" = array_remove("extendedKeyUsages", NULL::text) WHERE array_position("extendedKeyUsages", NULL::text) IS NOT NULL`
+ );
}
export async function down(): Promise<void> {