sqlitePush() — drizzle-orm Function Reference
Architecture documentation for the sqlitePush() function in push.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD d5e531dd_96a9_6b7d_4539_09bbbce0b9f5["sqlitePush()"] 6219550e_1686_ca7a_0d96_0838fb90e7cb["push.ts"] d5e531dd_96a9_6b7d_4539_09bbbce0b9f5 -->|defined in| 6219550e_1686_ca7a_0d96_0838fb90e7cb a6191ddf_c119_718d_8adb_1cf1f8e385b3["render()"] d5e531dd_96a9_6b7d_4539_09bbbce0b9f5 -->|calls| a6191ddf_c119_718d_8adb_1cf1f8e385b3 style d5e531dd_96a9_6b7d_4539_09bbbce0b9f5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/cli/commands/push.ts lines 413–532
export const sqlitePush = async (
schemaPath: string | string[],
verbose: boolean,
strict: boolean,
credentials: SqliteCredentials,
tablesFilter: string[],
force: boolean,
casing: CasingType | undefined,
) => {
const { connectToSQLite } = await import('../connections');
const { sqlitePushIntrospect } = await import('./sqliteIntrospect');
const db = await connectToSQLite(credentials);
const { schema } = await sqlitePushIntrospect(db, tablesFilter);
const { prepareSQLitePush } = await import('./migrate');
const statements = await prepareSQLitePush(schemaPath, schema, casing);
if (statements.sqlStatements.length === 0) {
render(`\n[${chalk.blue('i')}] No changes detected`);
} else {
const {
shouldAskForApprove,
statementsToExecute,
columnsToRemove,
tablesToRemove,
tablesToTruncate,
infoToPrint,
schemasToRemove,
} = await sqliteSuggestions(
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
Calls
Source
Frequently Asked Questions
What does sqlitePush() do?
sqlitePush() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/push.ts.
Where is sqlitePush() defined?
sqlitePush() is defined in drizzle-kit/src/cli/commands/push.ts at line 413.
What does sqlitePush() call?
sqlitePush() calls 1 function(s): render.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free