pgSuite.createCompositePrimaryKey() — drizzle-orm Function Reference
Architecture documentation for the pgSuite.createCompositePrimaryKey() function in pg.test.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD b8902e84_2cf2_5f7c_f934_a08ef48ebabb["pgSuite.createCompositePrimaryKey()"] 0408ab8f_6d6f_cdae_29f3_25c8efadbfae["pg.test.ts"] b8902e84_2cf2_5f7c_f934_a08ef48ebabb -->|defined in| 0408ab8f_6d6f_cdae_29f3_25c8efadbfae style b8902e84_2cf2_5f7c_f934_a08ef48ebabb fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/tests/push/pg.test.ts lines 918–963
async createCompositePrimaryKey() {
const client = new PGlite();
const schema1 = {};
const schema2 = {
table: pgTable('table', {
col1: integer('col1').notNull(),
col2: integer('col2').notNull(),
}, (t) => ({
pk: primaryKey({
columns: [t.col1, t.col2],
}),
})),
};
const { statements, sqlStatements } = await diffTestSchemasPush(
client,
schema1,
schema2,
[],
false,
['public'],
);
expect(statements).toStrictEqual([
{
type: 'create_table',
tableName: 'table',
schema: '',
compositePKs: ['col1,col2;table_col1_col2_pk'],
compositePkName: 'table_col1_col2_pk',
isRLSEnabled: false,
policies: [],
uniqueConstraints: [],
checkConstraints: [],
columns: [
{ name: 'col1', type: 'integer', primaryKey: false, notNull: true },
{ name: 'col2', type: 'integer', primaryKey: false, notNull: true },
],
},
]);
expect(sqlStatements).toStrictEqual([
'CREATE TABLE "table" (\n\t"col1" integer NOT NULL,\n\t"col2" integer NOT NULL,\n\tCONSTRAINT "table_col1_col2_pk" PRIMARY KEY("col1","col2")\n);\n',
]);
},
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does pgSuite.createCompositePrimaryKey() do?
pgSuite.createCompositePrimaryKey() is a function in the drizzle-orm codebase, defined in drizzle-kit/tests/push/pg.test.ts.
Where is pgSuite.createCompositePrimaryKey() defined?
pgSuite.createCompositePrimaryKey() is defined in drizzle-kit/tests/push/pg.test.ts at line 918.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free