Skip to content

Migrations

Database schema changes are managed through migrations, which are automatically generated by Drizzle ORM and stored in server/_/database/migrations. You typically won't need to modify these files directly unless you're making changes to your database structure.

Generating migrations

To run migrations, Drizzle generates types and SQL schema definitions for your database based on the current state of your database models.

To generate a migration, from the schema you need to run the following command:

sh
$ npm db:generate
sh
$ pnpm db:generate
sh
$ yarn db:generate

Creating Migrations

To run the migrations to the database, you need to run the following command:

sh
$ npm db:migrate
sh
$ pnpm db:migrate
sh
$ yarn db:migrate