logSuggestionsAndReturn() — drizzle-orm Function Reference
Architecture documentation for the logSuggestionsAndReturn() function in singlestorePushUtils.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD f32c8b45_d102_ae2f_22ae_08f69039bd00["logSuggestionsAndReturn()"] 65107a57_7714_63e5_7018_8c2efc0f3b41["singlestorePushUtils.ts"] f32c8b45_d102_ae2f_22ae_08f69039bd00 -->|defined in| 65107a57_7714_63e5_7018_8c2efc0f3b41 a6191ddf_c119_718d_8adb_1cf1f8e385b3["render()"] f32c8b45_d102_ae2f_22ae_08f69039bd00 -->|calls| a6191ddf_c119_718d_8adb_1cf1f8e385b3 2b006da9_92ff_ab47_ba6c_8ec3d041f7e3["findAddedAndRemoved()"] f32c8b45_d102_ae2f_22ae_08f69039bd00 -->|calls| 2b006da9_92ff_ab47_ba6c_8ec3d041f7e3 6e5697b6_dd34_9e57_e914_c45e2ef49e34["findColumnTypeAlternations()"] f32c8b45_d102_ae2f_22ae_08f69039bd00 -->|calls| 6e5697b6_dd34_9e57_e914_c45e2ef49e34 style f32c8b45_d102_ae2f_22ae_08f69039bd00 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/cli/commands/singlestorePushUtils.ts lines 128–456
export const logSuggestionsAndReturn = async (
db: DB,
statements: JsonStatement[],
json2: TypeOf<typeof singlestoreSchema>,
json1: TypeOf<typeof singlestoreSchema>,
) => {
let shouldAskForApprove = false;
const statementsToExecute: string[] = [];
const infoToPrint: string[] = [];
const tablesToRemove: string[] = [];
const columnsToRemove: string[] = [];
const schemasToRemove: string[] = [];
const tablesToTruncate: string[] = [];
for (const statement of statements) {
if (statement.type === 'drop_table') {
const res = await db.query(
`select count(*) as count from \`${statement.tableName}\``,
);
const count = Number(res[0].count);
if (count > 0) {
infoToPrint.push(
`· You're about to delete ${
chalk.underline(
statement.tableName,
)
} table with ${count} items`,
);
tablesToRemove.push(statement.tableName);
shouldAskForApprove = true;
}
} else if (statement.type === 'alter_table_drop_column') {
const res = await db.query(
`select count(*) as count from \`${statement.tableName}\``,
);
const count = Number(res[0].count);
if (count > 0) {
infoToPrint.push(
`· You're about to delete ${
chalk.underline(
statement.columnName,
)
} column in ${statement.tableName} table with ${count} items`,
);
columnsToRemove.push(`${statement.tableName}_${statement.columnName}`);
shouldAskForApprove = true;
}
} else if (statement.type === 'drop_schema') {
const res = await db.query(
`select count(*) as count from information_schema.tables where table_schema = \`${statement.name}\`;`,
);
const count = Number(res[0].count);
if (count > 0) {
infoToPrint.push(
`· You're about to delete ${
chalk.underline(
statement.name,
)
} schema with ${count} tables`,
);
schemasToRemove.push(statement.name);
shouldAskForApprove = true;
}
} else if (statement.type === 'alter_table_alter_column_set_type') {
const res = await db.query(
`select count(*) as count from \`${statement.tableName}\``,
);
const count = Number(res[0].count);
if (count > 0) {
infoToPrint.push(
`· You're about to change ${
chalk.underline(
statement.columnName,
)
} column type from ${
chalk.underline(
statement.oldDataType,
)
} to ${chalk.underline(statement.newDataType)} with ${count} items`,
);
Domain
Subdomains
Source
Frequently Asked Questions
What does logSuggestionsAndReturn() do?
logSuggestionsAndReturn() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/singlestorePushUtils.ts.
Where is logSuggestionsAndReturn() defined?
logSuggestionsAndReturn() is defined in drizzle-kit/src/cli/commands/singlestorePushUtils.ts at line 128.
What does logSuggestionsAndReturn() call?
logSuggestionsAndReturn() calls 3 function(s): findAddedAndRemoved, findColumnTypeAlternations, render.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free