preparePgCreateTableJson() — drizzle-orm Function Reference
Architecture documentation for the preparePgCreateTableJson() function in jsonStatements.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 472abbd3_7676_3f20_256e_dbd9ffe3910e["preparePgCreateTableJson()"] 6139f734_8ada_c641_9fec_9a55cfdf376f["jsonStatements.ts"] 472abbd3_7676_3f20_256e_dbd9ffe3910e -->|defined in| 6139f734_8ada_c641_9fec_9a55cfdf376f c7a398db_43c9_7771_09b7_73bc09e703e8["applyPgSnapshotsDiff()"] c7a398db_43c9_7771_09b7_73bc09e703e8 -->|calls| 472abbd3_7676_3f20_256e_dbd9ffe3910e style 472abbd3_7676_3f20_256e_dbd9ffe3910e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/src/jsonStatements.ts lines 889–917
export const preparePgCreateTableJson = (
table: Table,
// TODO: remove?
json2: PgSchema,
): JsonCreateTableStatement => {
const { name, schema, columns, compositePrimaryKeys, uniqueConstraints, checkConstraints, policies, isRLSEnabled } =
table;
const tableKey = `${schema || 'public'}.${name}`;
// TODO: @AndriiSherman. We need this, will add test cases
const compositePkName = Object.values(compositePrimaryKeys).length > 0
? json2.tables[tableKey].compositePrimaryKeys[
`${PgSquasher.unsquashPK(Object.values(compositePrimaryKeys)[0]).name}`
].name
: '';
return {
type: 'create_table',
tableName: name,
schema,
columns: Object.values(columns),
compositePKs: Object.values(compositePrimaryKeys),
compositePkName: compositePkName,
uniqueConstraints: Object.values(uniqueConstraints),
policies: Object.values(policies),
checkConstraints: Object.values(checkConstraints),
isRLSEnabled: isRLSEnabled ?? false,
};
};
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does preparePgCreateTableJson() do?
preparePgCreateTableJson() is a function in the drizzle-orm codebase, defined in drizzle-kit/src/jsonStatements.ts.
Where is preparePgCreateTableJson() defined?
preparePgCreateTableJson() is defined in drizzle-kit/src/jsonStatements.ts at line 889.
What calls preparePgCreateTableJson()?
preparePgCreateTableJson() 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