PgAlterPolicyConvertor Class — drizzle-orm Architecture
Architecture documentation for the PgAlterPolicyConvertor class in sqlgenerator.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 688e920c_121f_c9ad_65ae_4dc2ba1c7552["PgAlterPolicyConvertor"] fe4174c7_3b9c_5b26_98a0_b2395ca21939["sqlgenerator.ts"] 688e920c_121f_c9ad_65ae_4dc2ba1c7552 -->|defined in| fe4174c7_3b9c_5b26_98a0_b2395ca21939 17b58266_8517_1ec6_4371_d2c117179460["can()"] 688e920c_121f_c9ad_65ae_4dc2ba1c7552 -->|method| 17b58266_8517_1ec6_4371_d2c117179460 7b1239b0_ec02_9b5e_593f_a727e07d3fc0["convert()"] 688e920c_121f_c9ad_65ae_4dc2ba1c7552 -->|method| 7b1239b0_ec02_9b5e_593f_a727e07d3fc0
Relationship Graph
Source Code
drizzle-kit/src/sqlgenerator.ts lines 260–290
class PgAlterPolicyConvertor extends Convertor {
override can(statement: JsonStatement, dialect: Dialect): boolean {
return statement.type === 'alter_policy' && dialect === 'postgresql';
}
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
Defined In
Source
Frequently Asked Questions
What is the PgAlterPolicyConvertor class?
PgAlterPolicyConvertor is a class in the drizzle-orm codebase, defined in drizzle-kit/src/sqlgenerator.ts.
Where is PgAlterPolicyConvertor defined?
PgAlterPolicyConvertor is defined in drizzle-kit/src/sqlgenerator.ts at line 260.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free