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

prepareAndExportMysql() — drizzle-orm Function Reference

Architecture documentation for the prepareAndExportMysql() function in migrate.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  eaa78cbd_5a13_740d_6e64_0c3173007ebb["prepareAndExportMysql()"]
  b14d3855_8cce_38c9_8952_a9d014c2fb1b["migrate.ts"]
  eaa78cbd_5a13_740d_6e64_0c3173007ebb -->|defined in| b14d3855_8cce_38c9_8952_a9d014c2fb1b
  3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d["prepareMySqlMigrationSnapshot()"]
  eaa78cbd_5a13_740d_6e64_0c3173007ebb -->|calls| 3c058e8d_cc3e_dc1b_7c24_3f79a601ef9d
  f3976464_9993_b7cc_1cb7_d8087b203650["squashMysqlScheme()"]
  eaa78cbd_5a13_740d_6e64_0c3173007ebb -->|calls| f3976464_9993_b7cc_1cb7_d8087b203650
  a5972ffc_ff1b_9523_2495_5373af710e65["applyMysqlSnapshotsDiff()"]
  eaa78cbd_5a13_740d_6e64_0c3173007ebb -->|calls| a5972ffc_ff1b_9523_2495_5373af710e65
  b0ef3d06_896b_eefc_c410_dfb419673d70["error()"]
  eaa78cbd_5a13_740d_6e64_0c3173007ebb -->|calls| b0ef3d06_896b_eefc_c410_dfb419673d70
  style eaa78cbd_5a13_740d_6e64_0c3173007ebb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/cli/commands/migrate.ts lines 770–800

export const prepareAndExportMysql = async (config: ExportConfig) => {
	const schemaPath = config.schema;

	try {
		const { prev, cur, custom } = await prepareMySqlMigrationSnapshot(
			[],
			schemaPath,
			undefined,
		);

		const validatedPrev = mysqlSchema.parse(prev);
		const validatedCur = mysqlSchema.parse(cur);

		const squashedPrev = squashMysqlScheme(validatedPrev);
		const squashedCur = squashMysqlScheme(validatedCur);

		const { sqlStatements, statements, _meta } = await applyMysqlSnapshotsDiff(
			squashedPrev,
			squashedCur,
			tablesResolver,
			columnsResolver,
			mySqlViewsResolver,
			validatedPrev,
			validatedCur,
		);

		console.log(sqlStatements.join('\n'));
	} catch (e) {
		console.error(e);
	}
};

Domain

Subdomains

Frequently Asked Questions

What does prepareAndExportMysql() do?
prepareAndExportMysql() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/cli/commands/migrate.ts.
Where is prepareAndExportMysql() defined?
prepareAndExportMysql() is defined in drizzle-kit/src/cli/commands/migrate.ts at line 770.
What does prepareAndExportMysql() call?
prepareAndExportMysql() calls 4 function(s): applyMysqlSnapshotsDiff, error, prepareMySqlMigrationSnapshot, squashMysqlScheme.

Analyze Your Own Codebase

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

Try Supermodel Free