Skip to content

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

feat: handled empty user list in migration

=9cc271237afe
diff --git a/backend/src/db/migrations/20260404140728_username-merge.ts b/backend/src/db/migrations/20260404140728_username-merge.ts
index d2c9f19406..12e693f9b6 100644
--- a/backend/src/db/migrations/20260404140728_username-merge.ts
+++ b/backend/src/db/migrations/20260404140728_username-merge.ts
@@ -186,7 +186,7 @@ export async function up(knex: Knex): Promise<void> {
log(`Phase 3: reassigning FKs across ${userFkReferences.length} tables for ${allMergeLoserIds.length} losers...`);
t = Date.now();
let tablesProcessed = 0;
- for (const ref of userFkReferences) {
+ for (const ref of allMergeLoserIds.length > 0 ? userFkReferences : []) {
const refStart = Date.now();
const caseClauses = allMergeLoserIds
.map((loserId) => `WHEN '${loserId}'::uuid THEN '${loserToWinner.get(loserId)!}'::uuid`)