Skip to main content

Database & Async Runtime

Add sea-orm-x to the [dependencies] section of Cargo.toml. You can use either a local path or a git dependency.

Local Dependency

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

Git Dependency

Requires SSH access to the sea-orm-x repository. See Git Authentication in the Cargo Book.

Cargo.toml
sea-orm = { git = "ssh://git@github.com/SeaQL/sea-orm-x.git", features = ["runtime-tokio-rustls", "sqlz-mssql", "macros"] }
sea-orm-migration = { git = "ssh://git@github.com/SeaQL/sea-orm-x.git" }
Troubleshooting Git Authentication

If Cargo's built-in SSH client fails, force it to use your system SSH client:

~/.cargo/config.toml
[net]
git-fetch-with-cli = true

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

DATABASE_DRIVER

  • sqlz-mssql - SQLz MSSQL (SQL Server)

You can also enable drivers from the open-source SeaORM (sqlx-mysql, sqlx-postgres, sqlx-sqlite) alongside sqlz-mssql in the same codebase.

ASYNC_RUNTIME

You have to choose one from:

runtime-async-std-native-tls, runtime-tokio-native-tls, runtime-async-std-rustls, runtime-tokio-rustls

These are in the form of runtime-ASYNC_RUNTIME-TLS_LIB:

ASYNC_RUNTIMEWeb Framework
async-stdTide
tokioAxum, Actix, Poem, Rocket

native-tls uses the platform's native security facilities, while rustls is a pure Rust implementation.

Extra features

  • debug-print - print every SQL statement to logger
  • mock - mock interface for unit testing
  • macros - procedural macros for your convenience
  • 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
  • schema-sync - entity-first schema sync (create tables from entity definitions)
  • sea-orm-internal - opt-in unstable internal APIs