Skip to main content
Migrations allow you to evolve your database schema over time. Kit uses SeaORM migrations with a Laravel-inspired workflow.
For CLI commands (kit migrate, kit migrate:rollback, etc.), see the CLI Migrations Reference.

Creating Migrations

Generate a new migration file:
This creates a timestamped migration file in the migrations/ directory:

Migration Structure

Every migration has two methods:

Schema Operations

Creating Tables

Dropping Tables

Column Types

Column Modifiers

Adding Columns

Modifying Columns

Renaming Columns

Indexes

Creating Indexes

Composite Indexes

Dropping Indexes

Foreign Keys

Adding Foreign Keys

Foreign Key Actions

Migration Workflow

1. Create Migration

2. Edit the Migration

3. Run the Migration

4. Sync Entities

This generates the corresponding entity file in src/models/.

Best Practices

Always Write Down Migrations

Always implement down() to allow rollbacks:

Use Descriptive Names

One Change Per Migration

Keep migrations focused on a single change:

Test Migrations Both Ways

Before committing, verify both directions work:

CLI Commands Reference

See the CLI Migrations Reference for detailed command documentation.