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

prepareSqliteMigrationSnapshot() — drizzle-orm Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  9e7489ff_1b4d_bb21_dfdd_c572d42b308e["prepareSqliteMigrationSnapshot()"]
  4078709f_3fc0_5514_7728_8f28a7b0e807["migrationPreparator.ts"]
  9e7489ff_1b4d_bb21_dfdd_c572d42b308e -->|defined in| 4078709f_3fc0_5514_7728_8f28a7b0e807
  34d42b06_7a19_f47a_1ff9_7b6752ce0bda["prepareAndMigrateSqlite()"]
  34d42b06_7a19_f47a_1ff9_7b6752ce0bda -->|calls| 9e7489ff_1b4d_bb21_dfdd_c572d42b308e
  e98285fc_bf83_3aca_170c_8c0849802008["prepareAndExportSqlite()"]
  e98285fc_bf83_3aca_170c_8c0849802008 -->|calls| 9e7489ff_1b4d_bb21_dfdd_c572d42b308e
  fb79a54b_99a5_2063_0a0c_a9cc728865a9["prepareAndMigrateLibSQL()"]
  fb79a54b_99a5_2063_0a0c_a9cc728865a9 -->|calls| 9e7489ff_1b4d_bb21_dfdd_c572d42b308e
  86d84611_0fad_b786_2a9e_f7b234a52b6c["prepareAndExportLibSQL()"]
  86d84611_0fad_b786_2a9e_f7b234a52b6c -->|calls| 9e7489ff_1b4d_bb21_dfdd_c572d42b308e
  82d5a600_a693_cbbf_78ce_e20882738a3f["preparePrevSnapshot()"]
  9e7489ff_1b4d_bb21_dfdd_c572d42b308e -->|calls| 82d5a600_a693_cbbf_78ce_e20882738a3f
  635252db_7a68_131f_350d_60c2806f943d["serializeSQLite()"]
  9e7489ff_1b4d_bb21_dfdd_c572d42b308e -->|calls| 635252db_7a68_131f_350d_60c2806f943d
  style 9e7489ff_1b4d_bb21_dfdd_c572d42b308e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/migrationPreparator.ts lines 137–169

export const prepareSqliteMigrationSnapshot = async (
	snapshots: string[],
	schemaPath: string | string[],
	casing: CasingType | undefined,
): Promise<{ prev: SQLiteSchema; cur: SQLiteSchema; custom: SQLiteSchema }> => {
	const prevSnapshot = sqliteSchema.parse(
		preparePrevSnapshot(snapshots, drySQLite),
	);
	const serialized = await serializeSQLite(schemaPath, casing);

	const id = randomUUID();
	const idPrev = prevSnapshot.id;

	const { version, dialect, ...rest } = serialized;
	const result: SQLiteSchema = {
		version,
		dialect,
		id,
		prevId: idPrev,
		...rest,
	};

	const { id: _ignoredId, prevId: _ignoredPrevId, ...prevRest } = prevSnapshot;

	// that's for custom migrations, when we need new IDs, but old snapshot
	const custom: SQLiteSchema = {
		id,
		prevId: idPrev,
		...prevRest,
	};

	return { prev: prevSnapshot, cur: result, custom };
};

Domain

Subdomains

Frequently Asked Questions

What does prepareSqliteMigrationSnapshot() do?
prepareSqliteMigrationSnapshot() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/migrationPreparator.ts.
Where is prepareSqliteMigrationSnapshot() defined?
prepareSqliteMigrationSnapshot() is defined in drizzle-kit/src/migrationPreparator.ts at line 137.
What does prepareSqliteMigrationSnapshot() call?
prepareSqliteMigrationSnapshot() calls 2 function(s): preparePrevSnapshot, serializeSQLite.
What calls prepareSqliteMigrationSnapshot()?
prepareSqliteMigrationSnapshot() is called by 4 function(s): prepareAndExportLibSQL, prepareAndExportSqlite, prepareAndMigrateLibSQL, prepareAndMigrateSqlite.

Analyze Your Own Codebase

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

Try Supermodel Free