From bb8b3cb3294523c6067ef4cdc57779df80614ea4 Mon Sep 17 00:00:00 2001 From: yoni_ash Date: Thu, 11 Jun 2026 10:32:34 +0400 Subject: [PATCH] fix: add a short circuit to created/renamed prompts --- drizzle-kit/src/cli/commands/migrate.ts | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drizzle-kit/src/cli/commands/migrate.ts b/drizzle-kit/src/cli/commands/migrate.ts index 8c62a5edb2..835cfaaff9 100644 --- a/drizzle-kit/src/cli/commands/migrate.ts +++ b/drizzle-kit/src/cli/commands/migrate.ts @@ -1083,6 +1083,12 @@ export const promptColumnsConflicts = async ( do { const created = newColumns[index]; + // if there are no more missing columns to resolve, consider the rest of new columns as created + if (leftMissing.length === 0) { + result.created.push(...newColumns.slice(index)); + break; + } + const renames: RenamePropmtItem[] = leftMissing.map((it) => { return { from: it, to: created }; }); @@ -1156,6 +1162,13 @@ export const promptNamedConflict = async ( let leftMissing = [...missingItems]; do { const created = newItems[index]; + + // if there are no more missing items to resolve, consider the rest of new items as created + if (leftMissing.length === 0) { + result.created.push(...newItems.slice(index)); + break; + } + const renames: RenamePropmtItem[] = leftMissing.map((it) => { return { from: it, to: created }; }); @@ -1231,6 +1244,13 @@ export const promptNamedWithSchemasConflict = async ( let leftMissing = [...missingItems]; do { const created = newItems[index]; + + // if there are no more missing items to resolve, consider the rest of new items as created + if (leftMissing.length === 0) { + result.created.push(...newItems.slice(index)); + break; + } + const renames: RenamePropmtItem[] = leftMissing.map((it) => { return { from: it, to: created }; }); @@ -1309,6 +1329,13 @@ export const promptSchemasConflict = async ( let leftMissing = [...missingSchemas]; do { const created = newSchemas[index]; + + // if there are no more missing schemas to resolve, consider the rest of new schemas as created + if (leftMissing.length === 0) { + result.created.push(...newSchemas.slice(index)); + break; + } + const renames: RenamePropmtItem[] = leftMissing.map((it) => { return { from: it, to: created }; });