preparePgMigrationSnapshot() — drizzle-orm Function Reference
Architecture documentation for the preparePgMigrationSnapshot() function in migrationPreparator.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 3311f44b_d157_63e7_4694_edf07b92c90e["preparePgMigrationSnapshot()"] 4078709f_3fc0_5514_7728_8f28a7b0e807["migrationPreparator.ts"] 3311f44b_d157_63e7_4694_edf07b92c90e -->|defined in| 4078709f_3fc0_5514_7728_8f28a7b0e807 285d7baa_1c76_20e1_0c68_26eaff3a4a05["prepareAndMigratePg()"] 285d7baa_1c76_20e1_0c68_26eaff3a4a05 -->|calls| 3311f44b_d157_63e7_4694_edf07b92c90e 4e596a62_7d9b_59ea_a118_46bc45866220["prepareAndExportPg()"] 4e596a62_7d9b_59ea_a118_46bc45866220 -->|calls| 3311f44b_d157_63e7_4694_edf07b92c90e 82d5a600_a693_cbbf_78ce_e20882738a3f["preparePrevSnapshot()"] 3311f44b_d157_63e7_4694_edf07b92c90e -->|calls| 82d5a600_a693_cbbf_78ce_e20882738a3f dd36a37c_7a7b_0f61_31c0_b6a9f9c621ef["serializePg()"] 3311f44b_d157_63e7_4694_edf07b92c90e -->|calls| dd36a37c_7a7b_0f61_31c0_b6a9f9c621ef style 3311f44b_d157_63e7_4694_edf07b92c90e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/migrationPreparator.ts lines 171–196
export const preparePgMigrationSnapshot = async (
snapshots: string[],
schemaPath: string | string[],
casing: CasingType | undefined,
): Promise<{ prev: PgSchema; cur: PgSchema; custom: PgSchema }> => {
const prevSnapshot = pgSchema.parse(preparePrevSnapshot(snapshots, dryPg));
const serialized = await serializePg(schemaPath, casing);
const id = randomUUID();
const idPrev = prevSnapshot.id;
// const { version, dialect, ...rest } = serialized;
const result: PgSchema = { id, prevId: idPrev, ...serialized };
const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;
// that's for custom migrations, when we need new IDs, but old snapshot
const custom: PgSchema = {
id,
prevId: idPrev,
...prevRest,
};
return { prev: prevSnapshot, cur: result, custom };
};
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does preparePgMigrationSnapshot() do?
preparePgMigrationSnapshot() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/migrationPreparator.ts.
Where is preparePgMigrationSnapshot() defined?
preparePgMigrationSnapshot() is defined in drizzle-kit/src/migrationPreparator.ts at line 171.
What does preparePgMigrationSnapshot() call?
preparePgMigrationSnapshot() calls 2 function(s): preparePrevSnapshot, serializePg.
What calls preparePgMigrationSnapshot()?
preparePgMigrationSnapshot() is called by 2 function(s): prepareAndExportPg, prepareAndMigratePg.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free