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

prepareMigrationMetadata() — drizzle-orm Function Reference

Architecture documentation for the prepareMigrationMetadata() function in words.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  21a2b027_f99c_d889_2b99_967e43eec3c1["prepareMigrationMetadata()"]
  2c14ac3f_5429_5694_b208_fdafbc3b775b["words.ts"]
  21a2b027_f99c_d889_2b99_967e43eec3c1 -->|defined in| 2c14ac3f_5429_5694_b208_fdafbc3b775b
  cb2d3951_4fcb_d824_359b_9f044d2f7e6c["writeResult()"]
  cb2d3951_4fcb_d824_359b_9f044d2f7e6c -->|calls| 21a2b027_f99c_d889_2b99_967e43eec3c1
  style 21a2b027_f99c_d889_2b99_967e43eec3c1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/utils/words.ts lines 3–24

export const prepareMigrationMetadata = (
	idx: number,
	prefixMode: Prefix,
	name?: string,
) => {
	const prefix = prefixMode === 'index'
		? idx.toFixed(0).padStart(4, '0')
		: prefixMode === 'timestamp' || prefixMode === 'supabase'
		? new Date()
			.toISOString()
			.replace('T', '')
			.replaceAll('-', '')
			.replaceAll(':', '')
			.slice(0, 14)
		: prefixMode === 'unix'
		? Math.floor(Date.now() / 1000)
		: '';

	const suffix = name || `${adjectives.random()}_${heroes.random()}`;
	const tag = `${prefix}_${suffix}`;
	return { prefix, suffix, tag };
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does prepareMigrationMetadata() do?
prepareMigrationMetadata() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/utils/words.ts.
Where is prepareMigrationMetadata() defined?
prepareMigrationMetadata() is defined in drizzle-kit/src/utils/words.ts at line 3.
What calls prepareMigrationMetadata()?
prepareMigrationMetadata() is called by 1 function(s): writeResult.

Analyze Your Own Codebase

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

Try Supermodel Free