Skip to content

code_schema

code_schema reads your ORM schema files and returns table columns with their types. No live database connection required — it works from the indexed schema definitions.

code_schema()
code_schema(table="users")
code_schema(table="orders")
ParameterTypeDefaultDescription
tablestringTable name to look up; omit to list all tables
Table: users
id uuid NOT NULL PRIMARY KEY
email varchar(255) NOT NULL UNIQUE
name varchar(100) NOT NULL
created_at timestamp NOT NULL DEFAULT now()
deleted_at timestamp NULL
Table: orders
id uuid NOT NULL PRIMARY KEY
user_id uuid NOT NULL FK → users.id
total integer NOT NULL
status order_status NOT NULL DEFAULT 'pending'
  • Drizzle ORM
  • Prisma
  • TypeORM
  • Understand the shape of a table before writing a query
  • Confirm column names and types when debugging type errors
  • Review foreign key relationships between tables
  • Onboarding — understand the data model without reading schema files manually