Getting Started
Configuration
Troubleshooting
The configuration file allows you to customize how the system interacts with your database. By creating this file, you define where your data structures are stored, where generated files should be saved, and the credentials required to connect to your database.
To customize your project settings, follow these steps to create and populate your configuration file:
drizzle.config.ts in your main project directory.The following table outlines the settings you can use to tailor the tool to your project needs:
Below is a standard example of how to structure your settings. You can copy this into your project and modify the values to match your specific environment:
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
schema: './src/schema.ts',
out: './migrations',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
});Tip
Use environment variables for your database URL instead of hardcoding sensitive credentials directly into your configuration file.
Warning
Ensure the directory specified in the out property exists or is writable by the system, otherwise the migration generation process will fail.
Important
If you change your schema path after creating migrations, the tool may lose track of your database history. Always verify your paths before running migration commands.
When managing your configuration, keep your file clean and ensure that your database credentials remain secure. Regularly check that the paths defined in your drizzle.config.ts match your current project structure to avoid unexpected errors during the migration process.
The diagram below illustrates how your configuration file dictates the interaction between your code and your database: