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 7b1239b0_ec02_9b5e_593f_a727e07d3fc0["convert()"] 688e920c_121f_c9ad_65ae_4dc2ba1c7552["PgAlterPolicyConvertor"] 7b1239b0_ec02_9b5e_593f_a727e07d3fc0 -->|defined in| 688e920c_121f_c9ad_65ae_4dc2ba1c7552 style 7b1239b0_ec02_9b5e_593f_a727e07d3fc0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/sqlgenerator.ts lines 264–289
override convert(statement: JsonAlterPolicyStatement, _dialect: any, action?: string): string | string[] {
const newPolicy = action === 'push'
? PgSquasher.unsquashPolicyPush(statement.newData)
: PgSquasher.unsquashPolicy(statement.newData);
const oldPolicy = action === 'push'
? PgSquasher.unsquashPolicyPush(statement.oldData)
: PgSquasher.unsquashPolicy(statement.oldData);
const tableNameWithSchema = statement.schema
? `"${statement.schema}"."${statement.tableName}"`
: `"${statement.tableName}"`;
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 ${tableNameWithSchema} TO ${newPolicy.to}${usingPart}${withCheckPart};`;
}
Domain
Subdomains
Defined In
Source
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 264.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free