Home / Function/ pgSuite.dropGeneratedConstraint() — drizzle-orm Function Reference

pgSuite.dropGeneratedConstraint() — drizzle-orm Function Reference

Architecture documentation for the pgSuite.dropGeneratedConstraint() function in pg.test.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  79928487_5967_8dd9_c622_b6fc2973dbaf["pgSuite.dropGeneratedConstraint()"]
  0408ab8f_6d6f_cdae_29f3_25c8efadbfae["pg.test.ts"]
  79928487_5967_8dd9_c622_b6fc2973dbaf -->|defined in| 0408ab8f_6d6f_cdae_29f3_25c8efadbfae
  style 79928487_5967_8dd9_c622_b6fc2973dbaf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-kit/tests/push/pg.test.ts lines 425–463

	async dropGeneratedConstraint() {
		const client = new PGlite();

		const schema1 = {
			users: pgTable('users', {
				id: integer('id'),
				id2: integer('id2'),
				name: text('name'),
				generatedName: text('gen_name').generatedAlwaysAs((): SQL => sql`${schema1.users.name}`),
			}),
		};
		const schema2 = {
			users: pgTable('users', {
				id: integer('id'),
				id2: integer('id2'),
				name: text('name'),
				generatedName: text('gen_name'),
			}),
		};

		const { statements, sqlStatements } = await diffTestSchemasPush(client, schema1, schema2, [], false, ['public']);

		expect(statements).toStrictEqual([
			{
				columnAutoIncrement: undefined,
				columnDefault: undefined,
				columnGenerated: undefined,
				columnName: 'gen_name',
				columnNotNull: false,
				columnOnUpdate: undefined,
				columnPk: false,
				newDataType: 'text',
				schema: '',
				tableName: 'users',
				type: 'alter_table_alter_column_drop_generated',
			},
		]);
		expect(sqlStatements).toStrictEqual(['ALTER TABLE "users" ALTER COLUMN "gen_name" DROP EXPRESSION;']);
	},

Domain

Subdomains

Frequently Asked Questions

What does pgSuite.dropGeneratedConstraint() do?
pgSuite.dropGeneratedConstraint() is a function in the drizzle-orm codebase, defined in drizzle-kit/tests/push/pg.test.ts.
Where is pgSuite.dropGeneratedConstraint() defined?
pgSuite.dropGeneratedConstraint() is defined in drizzle-kit/tests/push/pg.test.ts at line 425.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free