SeaORM v0.3.0 Release Notes

Release Date: 2021-10-15 // over 2 years ago
  • https://www.sea-ql.org/SeaORM/blog/2021-10-15-whats-new-in-0.3.0

    • 👍 Built-in Rocket support
    • ConnectOptions
    let mut opt = ConnectOptions::new("protocol://username:password@host/database".to_owned());
    opt.max_connections(100)
        .min_connections(5)
        .connect_timeout(Duration::from_secs(8))
        .idle_timeout(Duration::from_secs(8));
    let db = Database::connect(opt).await?;
    
    • [#211] Throw error if none of the db rows are affected
    assert_eq!(
        Update::one(cake::ActiveModel {
            name: Set("Cheese Cake".to_owned()),
            ..model.into_active_model()
        })
        .exec(&db)
        .await,
        Err(DbErr::RecordNotFound(
            "None of the database rows are affected".to_owned()
        ))
    );
    
    // update many remains the same
    assert_eq!(
        Update::many(cake::Entity)
            .col_expr(cake::Column::Name, Expr::value("Cheese Cake".to_owned()))
            .filter(cake::Column::Id.eq(2))
            .exec(&db)
            .await,
        Ok(UpdateResult { rows_affected: 0 })
    );
    
    • [#223] ActiveValue::take() & ActiveValue::into_value() without unwrap()
    • 0️⃣ [#205] Drop Default trait bound of PrimaryKeyTrait::ValueType
    • [#222] Transaction & streaming
    • ⚡️ [#210] Update ActiveModelBehavior API
    • [#240] Add derive DeriveIntoActiveModel and IntoActiveValue trait
    • 👍 [#237] Introduce optional serde support for model code generation
    • [#246] Add #[automatically_derived] to all derived implementations