Home / Function/ preparePrevSnapshot() — drizzle-orm Function Reference

preparePrevSnapshot() — drizzle-orm Function Reference

Architecture documentation for the preparePrevSnapshot() function in migrationPreparator.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  82d5a600_a693_cbbf_78ce_e20882738a3f["preparePrevSnapshot()"]
  4078709f_3fc0_5514_7728_8f28a7b0e807["migrationPreparator.ts"]
  82d5a600_a693_cbbf_78ce_e20882738a3f -->|defined in| 4078709f_3fc0_5514_7728_8f28a7b0e807
  3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d["prepareMySqlMigrationSnapshot()"]
  3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d -->|calls| 82d5a600_a693_cbbf_78ce_e20882738a3f
  1a78b4a5_969b_ab9d_737e_0b0d02a81073["prepareSingleStoreMigrationSnapshot()"]
  1a78b4a5_969b_ab9d_737e_0b0d02a81073 -->|calls| 82d5a600_a693_cbbf_78ce_e20882738a3f
  9e7489ff_1b4d_bb21_dfdd_c572d42b308e["prepareSqliteMigrationSnapshot()"]
  9e7489ff_1b4d_bb21_dfdd_c572d42b308e -->|calls| 82d5a600_a693_cbbf_78ce_e20882738a3f
  3311f44b_d157_63e7_4694_edf07b92c90e["preparePgMigrationSnapshot()"]
  3311f44b_d157_63e7_4694_edf07b92c90e -->|calls| 82d5a600_a693_cbbf_78ce_e20882738a3f
  style 82d5a600_a693_cbbf_78ce_e20882738a3f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/migrationPreparator.ts lines 198–208

const preparePrevSnapshot = (snapshots: string[], defaultPrev: any) => {
	let prevSnapshot: any;

	if (snapshots.length === 0) {
		prevSnapshot = defaultPrev;
	} else {
		const lastSnapshot = snapshots[snapshots.length - 1];
		prevSnapshot = JSON.parse(fs.readFileSync(lastSnapshot).toString());
	}
	return prevSnapshot;
};

Domain

Subdomains

Frequently Asked Questions

What does preparePrevSnapshot() do?
preparePrevSnapshot() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/migrationPreparator.ts.
Where is preparePrevSnapshot() defined?
preparePrevSnapshot() is defined in drizzle-kit/src/migrationPreparator.ts at line 198.
What calls preparePrevSnapshot()?
preparePrevSnapshot() is called by 4 function(s): prepareMySqlMigrationSnapshot, preparePgMigrationSnapshot, prepareSingleStoreMigrationSnapshot, prepareSqliteMigrationSnapshot.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free