pushSingleStoreSchema() — drizzle-orm Function Reference
Architecture documentation for the pushSingleStoreSchema() function in api.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 09737f8b_925a_9628_47ce_149d9e6cce58["pushSingleStoreSchema()"] e668bfef_9125_1ef0_2f94_a0f9605584bd["api.ts"] 09737f8b_925a_9628_47ce_149d9e6cce58 -->|defined in| e668bfef_9125_1ef0_2f94_a0f9605584bd 6bbf7ad1_6052_d345_e9c5_7eda2f0abb09["generateSingleStoreDrizzleJson()"] 09737f8b_925a_9628_47ce_149d9e6cce58 -->|calls| 6bbf7ad1_6052_d345_e9c5_7eda2f0abb09 8b30b0b0_f854_4a9f_f8d2_9f42f47b3c3a["squashSingleStoreScheme()"] 09737f8b_925a_9628_47ce_149d9e6cce58 -->|calls| 8b30b0b0_f854_4a9f_f8d2_9f42f47b3c3a 5e0b1139_8050_e207_b519_7736291ee6af["logSuggestionsAndReturn()"] 09737f8b_925a_9628_47ce_149d9e6cce58 -->|calls| 5e0b1139_8050_e207_b519_7736291ee6af style 09737f8b_925a_9628_47ce_149d9e6cce58 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/api.ts lines 545–602
export const pushSingleStoreSchema = async (
imports: Record<string, unknown>,
drizzleInstance: SingleStoreDriverDatabase<any>,
databaseName: string,
) => {
const { applySingleStoreSnapshotsDiff } = await import('./snapshotsDiffer');
const { logSuggestionsAndReturn } = await import(
'./cli/commands/singlestorePushUtils'
);
const { singlestorePushIntrospect } = await import(
'./cli/commands/singlestoreIntrospect'
);
const { sql } = await import('drizzle-orm');
const db: DB = {
query: async (query: string) => {
const res = await drizzleInstance.execute(sql.raw(query));
return res[0] as unknown as any[];
},
};
const cur = await generateSingleStoreDrizzleJson(imports);
const { schema: prev } = await singlestorePushIntrospect(db, databaseName, []);
const validatedPrev = singlestoreSchema.parse(prev);
const validatedCur = singlestoreSchema.parse(cur);
const squashedPrev = squashSingleStoreScheme(validatedPrev);
const squashedCur = squashSingleStoreScheme(validatedCur);
const { statements } = await applySingleStoreSnapshotsDiff(
squashedPrev,
squashedCur,
tablesResolver,
columnsResolver,
/* singleStoreViewsResolver, */
validatedPrev,
validatedCur,
'push',
);
const { shouldAskForApprove, statementsToExecute, infoToPrint } = await logSuggestionsAndReturn(
db,
statements,
validatedCur,
validatedPrev,
);
return {
hasDataLoss: shouldAskForApprove,
warnings: infoToPrint,
statementsToExecute,
apply: async () => {
for (const dStmnt of statementsToExecute) {
await db.query(dStmnt);
}
},
};
};
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does pushSingleStoreSchema() do?
pushSingleStoreSchema() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/api.ts.
Where is pushSingleStoreSchema() defined?
pushSingleStoreSchema() is defined in drizzle-kit/src/api.ts at line 545.
What does pushSingleStoreSchema() call?
pushSingleStoreSchema() calls 3 function(s): generateSingleStoreDrizzleJson, logSuggestionsAndReturn, squashSingleStoreScheme.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free