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 1d869c8b_bbf9_f3ee_b569_3fc6d43417ee["convert()"] b78b43b2_a7ca_13e8_bc8c_6611099c7f98["PgAlterTableAlterColumnSetGenerated"] 1d869c8b_bbf9_f3ee_b569_3fc6d43417ee -->|defined in| b78b43b2_a7ca_13e8_bc8c_6611099c7f98 style 1d869c8b_bbf9_f3ee_b569_3fc6d43417ee fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/sqlgenerator.ts lines 1010–1050
override convert(
statement: JsonAlterColumnSetIdentityStatement,
): string | string[] {
const { identity, tableName, columnName, schema } = statement;
const tableNameWithSchema = schema
? `"${schema}"."${tableName}"`
: `"${tableName}"`;
const unsquashedIdentity = PgSquasher.unsquashIdentity(identity);
const identityWithSchema = schema
? `"${schema}"."${unsquashedIdentity?.name}"`
: `"${unsquashedIdentity?.name}"`;
const identityStatement = unsquashedIdentity
? ` GENERATED ${
unsquashedIdentity.type === 'always' ? 'ALWAYS' : 'BY DEFAULT'
} AS IDENTITY (sequence name ${identityWithSchema}${
unsquashedIdentity.increment
? ` INCREMENT BY ${unsquashedIdentity.increment}`
: ''
}${
unsquashedIdentity.minValue
? ` MINVALUE ${unsquashedIdentity.minValue}`
: ''
}${
unsquashedIdentity.maxValue
? ` MAXVALUE ${unsquashedIdentity.maxValue}`
: ''
}${
unsquashedIdentity.startWith
? ` START WITH ${unsquashedIdentity.startWith}`
: ''
}${unsquashedIdentity.cache ? ` CACHE ${unsquashedIdentity.cache}` : ''}${
unsquashedIdentity.cycle ? ` CYCLE` : ''
})`
: '';
return `ALTER TABLE ${tableNameWithSchema} ALTER COLUMN "${columnName}" ADD${identityStatement};`;
}
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 1010.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free