Home / Function/ pgSchema() — drizzle-orm Function Reference

pgSchema() — drizzle-orm Function Reference

Architecture documentation for the pgSchema() function in schema.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  b86a89b0_1550_7be4_f345_2fcdcac952db["pgSchema()"]
  06e0abfd_8dae_0f31_4535_349e0a684907["schema.ts"]
  b86a89b0_1550_7be4_f345_2fcdcac952db -->|defined in| 06e0abfd_8dae_0f31_4535_349e0a684907
  cb98271f_26ce_30a5_c69f_b167a0a9c063["pgTable()"]
  b86a89b0_1550_7be4_f345_2fcdcac952db -->|calls| cb98271f_26ce_30a5_c69f_b167a0a9c063
  style b86a89b0_1550_7be4_f345_2fcdcac952db fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/pg-core/schema.ts lines 64–72

export function pgSchema<T extends string>(name: T) {
	if (name === 'public') {
		throw new Error(
			`You can't specify 'public' as schema name. Postgres is using public schema by default. If you want to use 'public' schema, just use pgTable() instead of creating a schema`,
		);
	}

	return new PgSchema(name);
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does pgSchema() do?
pgSchema() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/pg-core/schema.ts.
Where is pgSchema() defined?
pgSchema() is defined in drizzle-orm/src/pg-core/schema.ts at line 64.
What does pgSchema() call?
pgSchema() calls 1 function(s): pgTable.

Analyze Your Own Codebase

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

Try Supermodel Free