Skip to main content
doc0blade47/drizzle-ormdocumentation home
Sign in

Introspecting Databases

Last updated Oct 12, 2026100% grounded

Overview

Database introspection inspects an existing database structure and automatically generates corresponding TypeScript schema and relation code for your project. This saves you from writing schema definitions by hand when working with an already established database.

Note

Introspection analyzes your database tables, columns, constraints, and relationships to produce TypeScript files ready for use in your application.

How It Works

When you run an introspection command, the system connects to your database, reads the system catalog and information schema, and compiles the layout into TypeScript code.

Supported Database Dialects

Introspection supports multiple database providers and dialects. Supported dialects: postgresql, mysql, sqlite, turso, singlestore, gel.

(Sources: drizzle-kit/src/cli/schema.ts)

Outputs

Depending on the database dialect and configuration, introspection typically generates:

  • Schema file (schema.ts): Contains table definitions, columns, data types, and constraints.
  • Relations file (relations.ts): Contains table relationships when applicable.

Tip

If your project already contains migration history snapshots, introspection will recognize them and avoid duplicating migration files.

Was this page helpful?