pgSuite.createTableWithGeneratedConstraint() — drizzle-orm Function Reference
Architecture documentation for the pgSuite.createTableWithGeneratedConstraint() function in pg.test.ts from the drizzle-orm codebase.
Entity Profile
Dependency Diagram
graph TD 1d5eaa50_22fe_5df5_9c7c_41ea6700fcc8["pgSuite.createTableWithGeneratedConstraint()"] 0408ab8f_6d6f_cdae_29f3_25c8efadbfae["pg.test.ts"] 1d5eaa50_22fe_5df5_9c7c_41ea6700fcc8 -->|defined in| 0408ab8f_6d6f_cdae_29f3_25c8efadbfae style 1d5eaa50_22fe_5df5_9c7c_41ea6700fcc8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
drizzle-kit/tests/push/pg.test.ts lines 491–552
async createTableWithGeneratedConstraint() {
const client = new PGlite();
const schema1 = {};
const schema2 = {
users: pgTable('users', {
id: integer('id'),
id2: integer('id2'),
name: text('name'),
generatedName: text('gen_name').generatedAlwaysAs((): SQL => sql`${schema2.users.name} || 'hello'`),
}),
};
const { statements, sqlStatements } = await diffTestSchemasPush(client, schema1, schema2, [], false, ['public']);
expect(statements).toStrictEqual([
{
columns: [
{
name: 'id',
notNull: false,
primaryKey: false,
type: 'integer',
},
{
name: 'id2',
notNull: false,
primaryKey: false,
type: 'integer',
},
{
name: 'name',
notNull: false,
primaryKey: false,
type: 'text',
},
{
generated: {
as: '"users"."name" || \'hello\'',
type: 'stored',
},
name: 'gen_name',
notNull: false,
primaryKey: false,
type: 'text',
},
],
compositePKs: [],
compositePkName: '',
isRLSEnabled: false,
schema: '',
tableName: 'users',
policies: [],
type: 'create_table',
uniqueConstraints: [],
checkConstraints: [],
},
]);
expect(sqlStatements).toStrictEqual([
'CREATE TABLE "users" (\n\t"id" integer,\n\t"id2" integer,\n\t"name" text,\n\t"gen_name" text GENERATED ALWAYS AS ("users"."name" || \'hello\') STORED\n);\n',
]);
},
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does pgSuite.createTableWithGeneratedConstraint() do?
pgSuite.createTableWithGeneratedConstraint() is a function in the drizzle-orm codebase, defined in drizzle-kit/tests/push/pg.test.ts.
Where is pgSuite.createTableWithGeneratedConstraint() defined?
pgSuite.createTableWithGeneratedConstraint() is defined in drizzle-kit/tests/push/pg.test.ts at line 491.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free