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

convert() — drizzle-orm Function Reference

Architecture documentation for the convert() function in sqlgenerator.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  01e3d841_29c8_7a33_c439_06e82ef4a7c0["convert()"]
  ec455f9f_6d1b_1eed_d0b1_989378462f4d["PgAlterIndPolicyConvertor"]
  01e3d841_29c8_7a33_c439_06e82ef4a7c0 -->|defined in| ec455f9f_6d1b_1eed_d0b1_989378462f4d
  style 01e3d841_29c8_7a33_c439_06e82ef4a7c0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/src/sqlgenerator.ts lines 337–354

	override convert(statement: JsonAlterIndPolicyStatement): string | string[] {
		const newPolicy = statement.newData;
		const oldPolicy = statement.oldData;

		const usingPart = newPolicy.using
			? ` USING (${newPolicy.using})`
			: oldPolicy.using
			? ` USING (${oldPolicy.using})`
			: '';

		const withCheckPart = newPolicy.withCheck
			? ` WITH CHECK (${newPolicy.withCheck})`
			: oldPolicy.withCheck
			? ` WITH CHECK  (${oldPolicy.withCheck})`
			: '';

		return `ALTER POLICY "${oldPolicy.name}" ON ${oldPolicy.on} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
	}

Domain

Subdomains

Frequently Asked Questions

What does convert() do?
convert() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/sqlgenerator.ts.
Where is convert() defined?
convert() is defined in drizzle-kit/src/sqlgenerator.ts at line 337.

Analyze Your Own Codebase

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

Try Supermodel Free