Skip to content

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

misc: updated statement timeout

Sheen Capadngan394f1ae2bbb8
diff --git a/backend/src/db/migrations/20251028160921_delete-no-org-identities.ts b/backend/src/db/migrations/20251028160921_delete-no-org-identities.ts
index bf4692cf0c..c38b623803 100644
--- a/backend/src/db/migrations/20251028160921_delete-no-org-identities.ts
+++ b/backend/src/db/migrations/20251028160921_delete-no-org-identities.ts
@@ -2,14 +2,24 @@ import { Knex } from "knex";
import { TableName } from "../schemas";
+const MIGRATION_TIMEOUT = 30 * 60 * 1000; // 30 minutes
+
export async function up(knex: Knex): Promise<void> {
+ const result = await knex.raw("SHOW statement_timeout");
+ const originalTimeout = result.rows[0].statement_timeout;
+
await knex.transaction(async (tx) => {
- const hasIdentityOrgCol = await tx.schema.hasColumn(TableName.Identity, "orgId");
- if (hasIdentityOrgCol) {
- await tx(TableName.Identity).whereNull("orgId").delete();
- await tx.schema.alterTable(TableName.Identity, (t) => {
- t.uuid("orgId").notNullable().alter();
- });
+ try {
+ await tx.raw(`SET statement_timeout = ${MIGRATION_TIMEOUT}`);
+ const hasIdentityOrgCol = await tx.schema.hasColumn(TableName.Identity, "orgId");
+ if (hasIdentityOrgCol) {
+ await tx(TableName.Identity).whereNull("orgId").delete();
+ await tx.schema.alterTable(TableName.Identity, (t) => {
+ t.uuid("orgId").notNullable().alter();
+ });
+ }
+ } finally {
+ await knex.raw(`SET statement_timeout = '${originalTimeout}'`);
}
});
}