libSQLPush() — drizzle-orm Function Reference
Architecture documentation for the libSQLPush() function in push.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 282ad536_6bf2_f2d6_69aa_6c9e64464e83["libSQLPush()"] 6219550e_1686_ca7a_0d96_0838fb90e7cb["push.ts"] 282ad536_6bf2_f2d6_69aa_6c9e64464e83 -->|defined in| 6219550e_1686_ca7a_0d96_0838fb90e7cb a6191ddf_c119_718d_8adb_1cf1f8e385b3["render()"] 282ad536_6bf2_f2d6_69aa_6c9e64464e83 -->|calls| a6191ddf_c119_718d_8adb_1cf1f8e385b3 3fa496e9_2bff_7b59_f02a_4cc1a6cfcea7["libSqlLogSuggestionsAndReturn()"] 282ad536_6bf2_f2d6_69aa_6c9e64464e83 -->|calls| 3fa496e9_2bff_7b59_f02a_4cc1a6cfcea7 style 282ad536_6bf2_f2d6_69aa_6c9e64464e83 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/cli/commands/push.ts lines 534–639
export const libSQLPush = async (
schemaPath: string | string[],
verbose: boolean,
strict: boolean,
credentials: LibSQLCredentials,
tablesFilter: string[],
force: boolean,
casing: CasingType | undefined,
) => {
const { connectToLibSQL } = await import('../connections');
const { sqlitePushIntrospect } = await import('./sqliteIntrospect');
const db = await connectToLibSQL(credentials);
const { schema } = await sqlitePushIntrospect(db, tablesFilter);
const { prepareLibSQLPush } = await import('./migrate');
const statements = await prepareLibSQLPush(schemaPath, schema, casing);
if (statements.sqlStatements.length === 0) {
render(`\n[${chalk.blue('i')}] No changes detected`);
} else {
const {
shouldAskForApprove,
statementsToExecute,
columnsToRemove,
tablesToRemove,
tablesToTruncate,
infoToPrint,
} = await libSqlLogSuggestionsAndReturn(
db,
statements.statements,
statements.squashedPrev,
statements.squashedCur,
statements.meta!,
);
if (verbose && statementsToExecute.length > 0) {
console.log();
console.log(
withStyle.warning('You are about to execute current statements:'),
);
console.log();
console.log(statementsToExecute.map((s) => chalk.blue(s)).join('\n'));
console.log();
}
if (!force && strict) {
if (!shouldAskForApprove) {
const { status, data } = await render(
new Select(['No, abort', `Yes, I want to execute all statements`]),
);
if (data?.index === 0) {
render(`[${chalk.red('x')}] All changes were aborted`);
process.exit(0);
}
}
}
if (!force && shouldAskForApprove) {
console.log(withStyle.warning('Found data-loss statements:'));
console.log(infoToPrint.join('\n'));
console.log();
console.log(
chalk.red.bold(
'THIS ACTION WILL CAUSE DATA LOSS AND CANNOT BE REVERTED\n',
),
);
console.log(chalk.white('Do you still want to push changes?'));
const { status, data } = await render(
new Select([
'No, abort',
`Yes, I want to${
tablesToRemove.length > 0
? ` remove ${tablesToRemove.length} ${tablesToRemove.length > 1 ? 'tables' : 'table'},`
: ' '
}${
columnsToRemove.length > 0
? ` remove ${columnsToRemove.length} ${columnsToRemove.length > 1 ? 'columns' : 'column'},`
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does libSQLPush() do?
libSQLPush() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/push.ts.
Where is libSQLPush() defined?
libSQLPush() is defined in drizzle-kit/src/cli/commands/push.ts at line 534.
What does libSQLPush() call?
libSQLPush() calls 2 function(s): libSqlLogSuggestionsAndReturn, render.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free