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

prepareMigrationMeta() — drizzle-orm Function Reference

Architecture documentation for the prepareMigrationMeta() function in utils.ts from the drizzle-orm codebase.

Function typescript DrizzleKit Snapshots calls 3 called by 5

Entity Profile

Dependency Diagram

graph TD
  67d9f862_00db_57c6_0e17_66f2a9c4dc86["prepareMigrationMeta()"]
  9a65f2dd_b887_59d0_3288_3a5819ba6273["utils.ts"]
  67d9f862_00db_57c6_0e17_66f2a9c4dc86 -->|defined in| 9a65f2dd_b887_59d0_3288_3a5819ba6273
  651a6907_400a_48f5_83d0_674559a1b277["applyPgSnapshotsDiff()"]
  651a6907_400a_48f5_83d0_674559a1b277 -->|calls| 67d9f862_00db_57c6_0e17_66f2a9c4dc86
  1a35ad7c_c0dd_73ac_a1bb_74fa81f69b7e["applyMysqlSnapshotsDiff()"]
  1a35ad7c_c0dd_73ac_a1bb_74fa81f69b7e -->|calls| 67d9f862_00db_57c6_0e17_66f2a9c4dc86
  91fd4d71_23eb_0453_6d6a_8a662b768c63["applySingleStoreSnapshotsDiff()"]
  91fd4d71_23eb_0453_6d6a_8a662b768c63 -->|calls| 67d9f862_00db_57c6_0e17_66f2a9c4dc86
  b78205f3_fa66_a61c_5923_e5b12af08541["applySqliteSnapshotsDiff()"]
  b78205f3_fa66_a61c_5923_e5b12af08541 -->|calls| 67d9f862_00db_57c6_0e17_66f2a9c4dc86
  fec4a144_b571_887e_3760_6b838f6f6b16["applyLibSQLSnapshotsDiff()"]
  fec4a144_b571_887e_3760_6b838f6f6b16 -->|calls| 67d9f862_00db_57c6_0e17_66f2a9c4dc86
  4c7e44b2_e9fb_0e63_7db3_fb9b14bf2d38["schemaRenameKey()"]
  67d9f862_00db_57c6_0e17_66f2a9c4dc86 -->|calls| 4c7e44b2_e9fb_0e63_7db3_fb9b14bf2d38
  7121f55d_74b7_92c5_f4e2_a6fe97792bdb["tableRenameKey()"]
  67d9f862_00db_57c6_0e17_66f2a9c4dc86 -->|calls| 7121f55d_74b7_92c5_f4e2_a6fe97792bdb
  c5ea22e0_401e_4bfe_d8ec_15bd24db906f["columnRenameKey()"]
  67d9f862_00db_57c6_0e17_66f2a9c4dc86 -->|calls| c5ea22e0_401e_4bfe_d8ec_15bd24db906f
  style 67d9f862_00db_57c6_0e17_66f2a9c4dc86 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/utils.ts lines 248–280

export const prepareMigrationMeta = (
	schemas: { from: string; to: string }[],
	tables: { from: NamedWithSchema; to: NamedWithSchema }[],
	columns: {
		from: { table: string; schema: string; column: string };
		to: { table: string; schema: string; column: string };
	}[],
) => {
	const _meta = {
		schemas: {} as Record<string, string>,
		tables: {} as Record<string, string>,
		columns: {} as Record<string, string>,
	};

	schemas.forEach((it) => {
		const from = schemaRenameKey(it.from);
		const to = schemaRenameKey(it.to);
		_meta.schemas[from] = to;
	});
	tables.forEach((it) => {
		const from = tableRenameKey(it.from);
		const to = tableRenameKey(it.to);
		_meta.tables[from] = to;
	});

	columns.forEach((it) => {
		const from = columnRenameKey(it.from.table, it.from.schema, it.from.column);
		const to = columnRenameKey(it.to.table, it.to.schema, it.to.column);
		_meta.columns[from] = to;
	});

	return _meta;
};

Domain

Subdomains

Frequently Asked Questions

What does prepareMigrationMeta() do?
prepareMigrationMeta() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/utils.ts.
Where is prepareMigrationMeta() defined?
prepareMigrationMeta() is defined in drizzle-kit/src/utils.ts at line 248.
What does prepareMigrationMeta() call?
prepareMigrationMeta() calls 3 function(s): columnRenameKey, schemaRenameKey, tableRenameKey.
What calls prepareMigrationMeta()?
prepareMigrationMeta() is called by 5 function(s): applyLibSQLSnapshotsDiff, applyMysqlSnapshotsDiff, applyPgSnapshotsDiff, applySingleStoreSnapshotsDiff, applySqliteSnapshotsDiff.

Analyze Your Own Codebase

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

Try Supermodel Free