promptNamedWithSchemasConflict() — drizzle-orm Function Reference
Architecture documentation for the promptNamedWithSchemasConflict() function in migrate.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD c2f882e3_49a6_7f53_0523_ac2e67b07d8f["promptNamedWithSchemasConflict()"] b14d3855_8cce_38c9_8952_a9d014c2fb1b["migrate.ts"] c2f882e3_49a6_7f53_0523_ac2e67b07d8f -->|defined in| b14d3855_8cce_38c9_8952_a9d014c2fb1b 2381bda1_f151_c72c_7494_6acc619c954d["tablesResolver()"] 2381bda1_f151_c72c_7494_6acc619c954d -->|calls| c2f882e3_49a6_7f53_0523_ac2e67b07d8f 651c7e7f_df55_9121_60ef_9cb9381ff4ac["viewsResolver()"] 651c7e7f_df55_9121_60ef_9cb9381ff4ac -->|calls| c2f882e3_49a6_7f53_0523_ac2e67b07d8f 4390988c_6fdb_5c1f_d5d7_a4d15611a5d1["mySqlViewsResolver()"] 4390988c_6fdb_5c1f_d5d7_a4d15611a5d1 -->|calls| c2f882e3_49a6_7f53_0523_ac2e67b07d8f 1203e9e3_f171_963e_b898_13a3a20875d5["sqliteViewsResolver()"] 1203e9e3_f171_963e_b898_13a3a20875d5 -->|calls| c2f882e3_49a6_7f53_0523_ac2e67b07d8f 265d44ac_bb67_8fcd_3326_e0ebe5ffd4f7["sequencesResolver()"] 265d44ac_bb67_8fcd_3326_e0ebe5ffd4f7 -->|calls| c2f882e3_49a6_7f53_0523_ac2e67b07d8f 2cb46387_de58_6ec4_428f_4bb77f77993b["enumsResolver()"] 2cb46387_de58_6ec4_428f_4bb77f77993b -->|calls| c2f882e3_49a6_7f53_0523_ac2e67b07d8f b0ef3d06_896b_eefc_c410_dfb419673d70["error()"] c2f882e3_49a6_7f53_0523_ac2e67b07d8f -->|calls| b0ef3d06_896b_eefc_c410_dfb419673d70 9ede9a38_b1b5_ce9d_c690_714bf96b1a3e["isRenamePromptItem()"] c2f882e3_49a6_7f53_0523_ac2e67b07d8f -->|calls| 9ede9a38_b1b5_ce9d_c690_714bf96b1a3e style c2f882e3_49a6_7f53_0523_ac2e67b07d8f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/cli/commands/migrate.ts lines 1205–1293
export const promptNamedWithSchemasConflict = async <T extends NamedWithSchema>(
newItems: T[],
missingItems: T[],
entity: 'table' | 'enum' | 'sequence' | 'view',
): Promise<{
created: T[];
renamed: { from: T; to: T }[];
moved: { name: string; schemaFrom: string; schemaTo: string }[];
deleted: T[];
}> => {
if (missingItems.length === 0 || newItems.length === 0) {
return {
created: newItems,
renamed: [],
moved: [],
deleted: missingItems,
};
}
const result: {
created: T[];
renamed: { from: T; to: T }[];
moved: { name: string; schemaFrom: string; schemaTo: string }[];
deleted: T[];
} = { created: [], renamed: [], moved: [], deleted: [] };
let index = 0;
let leftMissing = [...missingItems];
do {
const created = newItems[index];
const renames: RenamePropmtItem<T>[] = leftMissing.map((it) => {
return { from: it, to: created };
});
const promptData: (RenamePropmtItem<T> | T)[] = [created, ...renames];
const { status, data } = await render(
new ResolveSelect<T>(created, promptData, entity),
);
if (status === 'aborted') {
console.error('ERROR');
process.exit(1);
}
if (isRenamePromptItem(data)) {
const schemaFromPrefix = !data.from.schema || data.from.schema === 'public'
? ''
: `${data.from.schema}.`;
const schemaToPrefix = !data.to.schema || data.to.schema === 'public'
? ''
: `${data.to.schema}.`;
console.log(
`${chalk.yellow('~')} ${schemaFromPrefix}${data.from.name} › ${schemaToPrefix}${data.to.name} ${
chalk.gray(
`${entity} will be renamed/moved`,
)
}`,
);
if (data.from.name !== data.to.name) {
result.renamed.push(data);
}
if (data.from.schema !== data.to.schema) {
result.moved.push({
name: data.from.name,
schemaFrom: data.from.schema || 'public',
schemaTo: data.to.schema || 'public',
});
}
delete leftMissing[leftMissing.indexOf(data.from)];
leftMissing = leftMissing.filter(Boolean);
} else {
console.log(
`${chalk.green('+')} ${data.name} ${
chalk.gray(
`${entity} will be created`,
)
}`,
);
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does promptNamedWithSchemasConflict() do?
promptNamedWithSchemasConflict() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/migrate.ts.
Where is promptNamedWithSchemasConflict() defined?
promptNamedWithSchemasConflict() is defined in drizzle-kit/src/cli/commands/migrate.ts at line 1205.
What does promptNamedWithSchemasConflict() call?
promptNamedWithSchemasConflict() calls 2 function(s): error, isRenamePromptItem.
What calls promptNamedWithSchemasConflict()?
promptNamedWithSchemasConflict() is called by 6 function(s): enumsResolver, mySqlViewsResolver, sequencesResolver, sqliteViewsResolver, tablesResolver, viewsResolver.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free