Skip to main content
Version: 0.5.x

Schema Management

If you already have a database with tables and data, you can skip this section.

If you are starting from a fresh database, it's actually better to version control your database schema with a migration tool.

We are still developing SeaORM's schema management utility, so for now you can use SQLx's sqlx-cli.

$ cargo install sqlx-cli

Set DATABASE_URL in your environment, or create a .env file in your project root. Specify your database connection.

DATABASE_URL=sql://username:[email protected]/database

Create a new .sql file.

$ sqlx migrate add <name>

Run migrations.

$ sqlx migrate run