Tell Drizzle Kit which database dialect and schema to process.
Migration generation
Drizzle ORM · Type Alias
DrizzleConfig describes the settings Drizzle Kit uses for database migrations and related operations. It is typically declared with defineConfig in drizzle.config.ts or a JavaScript configuration file.
DrizzleConfig is the configuration shape used by Drizzle Kit for a TypeScript or JavaScript configuration file. It describes database-related settings such as the SQL dialect, schema paths, migration output, and credentials; defineConfig provides the typed configuration declaration.
type DrizzleConfig = { dialect: string; schema?: string | string[]; out?: string; dbCredentials?: object; ... }| Name | Type | Description |
|---|---|---|
dialect | string | SQL database dialect, such as postgresql, mysql, sqlite, turso, singlestore, mssql, or cockroach. |
schema | string | Path to the schema file or schema directory used by Drizzle Kit. |
out | string | Optional directory for generated migrations; defaults to ./drizzle. |
dbCredentials | object | Database connection credentials used by commands that connect to the database. |
A Drizzle Kit configuration object consumed by migration and schema-management commands.
out setting chooses the migration directory and defaults to drizzle.import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: "postgresql",
schema: "./src/schema.ts",
out: "./drizzle",
});This configuration supplies the database dialect, schema location, and migration output directory.
Migration generation
Environment separation
Migration organization
DrizzleConfig is the configuration object consumed by Drizzle Kit. It is commonly exported through defineConfig from drizzle-kit and contains settings such as dialect, schema, out, and database credentials.
Follow-up: What minimum settings are needed for migration generation? The documentation requires the SQL dialect and the schema path.
dialect and schema settings control?dialect identifies the SQL database system, while schema points Drizzle Kit to the schema file or directory. Drizzle Kit uses these values when generating migrations.
Follow-up: How can a project support separate environments? Keep multiple configuration files and pass the desired file with the CLI --config option.
The out setting controls where migrations are written and is optional; the documentation gives ./drizzle as its default. Configuration can be supplied in a config file or through CLI parameters.
Follow-up: Why might CLI configuration be useful? It can support CI/CD or commands that need environment-specific settings without changing the project file.
defineConfigdrizzle.config.tsdialectschemaoutdbCredentialsDrizzle Kit