Skip to main content
Version: 2.0.x

Database & Async Runtime

We need your support! ⭐

Thank you for using SeaORM. Please star our GitHub repo!

First, add sea-orm to the [dependencies] section of Cargo.toml.

Cargo.toml
sea-orm = { version = "2.0.0-rc", features = [ <DATABASE_DRIVER>, <ASYNC_RUNTIME>, "macros" ] }

You must choose a DATABASE_DRIVER and an ASYNC_RUNTIME. macros is needed if you use SeaORM's generated entities (most likely).

DATABASE_DRIVER

You can choose one or more from:

  • sqlx-mysql - SQLx MySQL and MariaDB
  • sqlx-postgres - SQLx PostgreSQL
  • sqlx-sqlite - SQLx SQLite

See also: SQLx docs.

SQL Server (MSSQL) backend

The installation and configuration of MSSQL driver can be found here.

ASYNC_RUNTIME

You have to choose one from: runtime-tokio-native-tls, runtime-tokio-rustls

Basically, they are in the form of runtime-ASYNC_RUNTIME-TLS_LIB:

  • ASYNC_RUNTIME can be tokio
    • async-std has been deprecated
  • TLS_LIB can either be native-tls or rustls
    • native-tls uses the platform's native security facilities, while rustls is an (almost) pure Rust implementation.

Extra features

  • debug-print - print every SQL statement to logger
  • mock - mock interface for unit testing
  • macros - procedural macros, e.g. DeriveEntityModel
  • rbac - role-based access control
  • seaography - enable GraphQL support
  • schema-sync - enable sync features in SchemaBuilder

  • with-chrono - support chrono types
  • with-time - support time types
  • with-json - support serde-json types
  • with-rust_decimal - support rust_decimal types
  • with-bigdecimal - support bigdecimal types
  • with-uuid - support uuid types
  • with-ipnetwork - support Postgres ipnetwork
  • postgres-vector - support Postgres pgvector
  • postgres-array - support array types in Postgres, enabled by default

  • sqlite-use-returning-for-3_35 - use returning for SQLite, enabled by default
  • mariadb-use-returning - use returning for MariaDB