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

prepareMySqlMigrationSnapshot() — drizzle-orm Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d["prepareMySqlMigrationSnapshot()"]
  4078709f_3fc0_5514_7728_8f28a7b0e807["migrationPreparator.ts"]
  3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d -->|defined in| 4078709f_3fc0_5514_7728_8f28a7b0e807
  41b84052_7d33_8f63_3c95_ec57735ef60e["prepareAndMigrateMysql()"]
  41b84052_7d33_8f63_3c95_ec57735ef60e -->|calls| 3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d
  eaa78cbd_5a13_740d_6e64_0c3173007ebb["prepareAndExportMysql()"]
  eaa78cbd_5a13_740d_6e64_0c3173007ebb -->|calls| 3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d
  82d5a600_a693_cbbf_78ce_e20882738a3f["preparePrevSnapshot()"]
  3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d -->|calls| 82d5a600_a693_cbbf_78ce_e20882738a3f
  28658aa5_a9ca_196c_cf25_5227ba3e8e36["serializeMySql()"]
  3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d -->|calls| 28658aa5_a9ca_196c_cf25_5227ba3e8e36
  style 3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/migrationPreparator.ts lines 81–107

export const prepareMySqlMigrationSnapshot = async (
	migrationFolders: string[],
	schemaPath: string | string[],
	casing: CasingType | undefined,
): Promise<{ prev: MySqlSchema; cur: MySqlSchema; custom: MySqlSchema }> => {
	const prevSnapshot = mysqlSchema.parse(
		preparePrevSnapshot(migrationFolders, dryMySql),
	);
	const serialized = await serializeMySql(schemaPath, casing);

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

	const { version, dialect, ...rest } = serialized;
	const result: MySqlSchema = { 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: MySqlSchema = {
		id,
		prevId: idPrev,
		...prevRest,
	};

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

Domain

Subdomains

Frequently Asked Questions

What does prepareMySqlMigrationSnapshot() do?
prepareMySqlMigrationSnapshot() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/migrationPreparator.ts.
Where is prepareMySqlMigrationSnapshot() defined?
prepareMySqlMigrationSnapshot() is defined in drizzle-kit/src/migrationPreparator.ts at line 81.
What does prepareMySqlMigrationSnapshot() call?
prepareMySqlMigrationSnapshot() calls 2 function(s): preparePrevSnapshot, serializeMySql.
What calls prepareMySqlMigrationSnapshot()?
prepareMySqlMigrationSnapshot() is called by 2 function(s): prepareAndExportMysql, prepareAndMigrateMysql.

Analyze Your Own Codebase

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

Try Supermodel Free