github SeaQL/sea-orm 2.0.0-rc.37

one hour ago

New Features

ER Diagram Generation (sea-orm-cli generate entity --er-diagram)

sea-orm-cli can now generate a Mermaid ER diagram alongside the entity files. Pass --er-diagram to write entities.mermaid into the output directory:

sea-orm-cli generate entity -u postgres://... -o src/entity --er-diagram

The diagram annotates columns with PK, FK, and UK markers and renders all relations — including many-to-many via junction tables — as Mermaid erDiagram syntax. Example output:

image

PostgreSQL Statement Timeout (ConnectOptions::statement_timeout)

ConnectOptions now accepts a statement_timeout for PostgreSQL connections. The timeout is set via the connection options at connect time (no extra round-trip) and causes the server to abort any statement that exceeds the duration:

ConnectOptions::new(DATABASE_URL)
    .statement_timeout(Duration::from_secs(30))
    .to_owned()

Has no effect on MySQL or SQLite connections.

SQLite ?mode= URL Parameter Support (#2987)

The rusqlite driver now parses the ?mode= query parameter from SQLite connection URLs, matching the behaviour of the sqlx SQLite driver:

Mode Behaviour
rwc (default) Read-write, create if not exists
rw Read-write, must exist
ro Read-only
memory In-memory database
// Open an existing database read-only
let db = Database::connect("sqlite:./data.db?mode=ro").await?;

Unsupported parameters or unknown mode values return a DbErr::Conn error.

Bug Fixes

no-default-features compile errors with mac_address and proxy (#2992)

  • with-mac_address feature: added missing TryGetable impls, try_from_u64 impl, postgres array support, and with-json serde flag
  • proxy feature: removed an accidental hard dependency on serde_json (now only activated via with-json)
  • Fixed cfg guards on JSON/JSONB proxy row handling to require with-json

Don't miss a new sea-orm release

NewReleases is sending notifications on new releases.