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

preparePgCreateIndexesJson() — drizzle-orm Function Reference

Architecture documentation for the preparePgCreateIndexesJson() function in jsonStatements.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  5d9327a6_b100_9712_ad8d_66f510f0e675["preparePgCreateIndexesJson()"]
  6139f734_8ada_c641_9fec_9a55cfdf376f["jsonStatements.ts"]
  5d9327a6_b100_9712_ad8d_66f510f0e675 -->|defined in| 6139f734_8ada_c641_9fec_9a55cfdf376f
  c7a398db_43c9_7771_09b7_73bc09e703e8["applyPgSnapshotsDiff()"]
  c7a398db_43c9_7771_09b7_73bc09e703e8 -->|calls| 5d9327a6_b100_9712_ad8d_66f510f0e675
  style 5d9327a6_b100_9712_ad8d_66f510f0e675 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/jsonStatements.ts lines 2878–2906

export const preparePgCreateIndexesJson = (
	tableName: string,
	schema: string,
	indexes: Record<string, string>,
	fullSchema: PgSchema,
	action?: 'push' | undefined,
): JsonPgCreateIndexStatement[] => {
	if (action === 'push') {
		return Object.values(indexes).map((indexData) => {
			const unsquashedIndex = PgSquasher.unsquashIdxPush(indexData);
			const data = fullSchema.tables[`${schema === '' ? 'public' : schema}.${tableName}`]
				.indexes[unsquashedIndex.name];
			return {
				type: 'create_index_pg',
				tableName,
				data,
				schema,
			};
		});
	}
	return Object.values(indexes).map((indexData) => {
		return {
			type: 'create_index_pg',
			tableName,
			data: PgSquasher.unsquashIdx(indexData),
			schema,
		};
	});
};

Domain

Subdomains

Frequently Asked Questions

What does preparePgCreateIndexesJson() do?
preparePgCreateIndexesJson() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/jsonStatements.ts.
Where is preparePgCreateIndexesJson() defined?
preparePgCreateIndexesJson() is defined in drizzle-kit/src/jsonStatements.ts at line 2878.
What calls preparePgCreateIndexesJson()?
preparePgCreateIndexesJson() is called by 1 function(s): applyPgSnapshotsDiff.

Analyze Your Own Codebase

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

Try Supermodel Free