sea-orm

🐚 An async & dynamic ORM for Rust

APACHE-2.0 License

Downloads
13.1M
Stars
6.3K
Committers
202

Bot releases are hidden (Show)

sea-orm - 0.7.0

Published by tyt2y3 over 2 years ago

https://www.sea-ql.org/blog/2022-03-26-whats-new-in-0.7.0/

New Features

Enhancements

Bug Fixes

Breaking changes

  • Exclude mock from default features by @billy1624 https://github.com/SeaQL/sea-orm/pull/562
  • create_table_from_entity will no longer create index for MySQL, please use the new method create_index_from_entity

Documentations

Fixed Issues

New Contributors

Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.6.0...0.7.0

sea-orm - 0.6.0

Published by tyt2y3 over 2 years ago

https://www.sea-ql.org/blog/2022-02-07-whats-new-in-0.6.0/

New Features

Enhancements

Bug Fixes

Breaking Changes

Fixed Issues

New Contributors

Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.5.0...0.6.0

sea-orm - 0.5.0

Published by tyt2y3 over 2 years ago

https://www.sea-ql.org/blog/2022-01-01-whats-new-in-0.5.0/

Fixed Issues

Merged PRs

Breaking Changes

  • ActiveModel::insert and ActiveModel::update return Model instead of ActiveModel
  • Method ActiveModelBehavior::after_save takes Model as input instead of ActiveModel
  • Rename method sea_orm::unchanged_active_value_not_intended_for_public_use to sea_orm::Unchanged
  • Rename method ActiveValue::unset to ActiveValue::not_set
  • Rename method ActiveValue::is_unset to ActiveValue::is_not_set
  • PartialEq of ActiveValue will also check the equality of state instead of just checking the equality of value

New Contributors

Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.4.2...0.5.0

sea-orm - 0.4.2

Published by tyt2y3 almost 3 years ago

Fixed Issues

Merged PRs

New Contributors

Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.4.1...0.4.2

sea-orm - 0.4.1

Published by tyt2y3 almost 3 years ago

Fixed Issues

Merged PRs

New Contributors

Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.4.0...0.4.1

sea-orm - 0.4.0

Published by tyt2y3 almost 3 years ago

https://www.sea-ql.org/blog/2021-11-19-whats-new-in-0.4.0/

Fixed Issues

Merged PRs

Breaking Changes

  • Refactor paginate() & count() utilities into PaginatorTrait. You can use the paginator as usual but you might need to import PaginatorTrait manually when upgrading from previous version.
    use futures::TryStreamExt;
    use sea_orm::{entity::*, query::*, tests_cfg::cake};
    
    let mut cake_stream = cake::Entity::find()
        .order_by_asc(cake::Column::Id)
        .paginate(db, 50)
        .into_stream();
    
    while let Some(cakes) = cake_stream.try_next().await? {
        // Do something on cakes: Vec<cake::Model>
    }
    
  • The helper struct Schema converting EntityTrait into different sea-query statement now has to be initialized with DbBackend.
    use sea_orm::{tests_cfg::*, DbBackend, Schema};
    use sea_orm::sea_query::TableCreateStatement;
    
    // 0.3.x
    let _: TableCreateStatement = Schema::create_table_from_entity(cake::Entity);
    
    // 0.4.x
    let schema: Schema = Schema::new(DbBackend::MySql);
    let _: TableCreateStatement = schema.create_table_from_entity(cake::Entity);
    
  • When performing insert or update operation on ActiveModel against PostgreSQL, RETURNING clause will be used to perform select in a single SQL statement.
    // For PostgreSQL
    cake::ActiveModel {
        name: Set("Apple Pie".to_owned()),
        ..Default::default()
    }
    .insert(&postgres_db)
    .await?;
    
    assert_eq!(
        postgres_db.into_transaction_log(),
        vec![Transaction::from_sql_and_values(
            DbBackend::Postgres,
            r#"INSERT INTO "cake" ("name") VALUES ($1) RETURNING "id", "name""#,
            vec!["Apple Pie".into()]
        )]);
    
    // For MySQL & SQLite
    cake::ActiveModel {
        name: Set("Apple Pie".to_owned()),
        ..Default::default()
    }
    .insert(&other_db)
    .await?;
    
    assert_eq!(
        other_db.into_transaction_log(),
        vec![
            Transaction::from_sql_and_values(
                DbBackend::MySql,
                r#"INSERT INTO `cake` (`name`) VALUES (?)"#,
                vec!["Apple Pie".into()]
            ),
            Transaction::from_sql_and_values(
                DbBackend::MySql,
                r#"SELECT `cake`.`id`, `cake`.`name` FROM `cake` WHERE `cake`.`id` = ? LIMIT ?"#,
                vec![15.into(), 1u64.into()]
            )]);
    

New Contributors

Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.3.2...0.4.0

sea-orm - 0.3.2

Published by tyt2y3 almost 3 years ago

Fixed Issues

Merged PRs

New Contributors

Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.3.1...0.3.2

sea-orm - 0.3.1

Published by tyt2y3 almost 3 years ago

Fixed Issues

  • Align case trasforms across derive macros #262
  • Added is_null and is_not_null to ColumnTrait #267

Merged PRs

New Contributors

Full Changelog: https://github.com/SeaQL/sea-orm/compare/0.3.0...0.3.1

sea-orm - 0.3.0

Published by tyt2y3 about 3 years ago

https://www.sea-ql.org/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()
    ))
);

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()
  • [#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
sea-orm - 0.2.6

Published by tyt2y3 about 3 years ago

  • [#224] [sea-orm-cli] Date & Time column type mapping
  • Escape rust keywords with r# raw identifier
sea-orm - 0.2.5

Published by tyt2y3 about 3 years ago

  • [#227] Resolve "Inserting actual none value of Option results in panic"
  • [#219] [sea-orm-cli] Add --tables option
  • [#189] Add debug_query and debug_query_stmt macro
sea-orm - 0.2.4

Published by tyt2y3 about 3 years ago

https://www.sea-ql.org/blog/2021-10-01-whats-new-in-0.2.4/

  • [[#186]] [sea-orm-cli] Foreign key handling
  • [[#191]] [sea-orm-cli] Unique key handling
  • [[#182]] find_linked join with alias
  • [[#202]] Accept both postgres:// and postgresql://
  • [[#208]] Support feteching T, (T, U), (T, U, P) etc
  • [[#209]] Rename column name & column enum variant
  • [[#207]] Support chrono::NaiveDate & chrono::NaiveTime
  • Support Condition::not (from sea-query)
sea-orm - 0.2.3

Published by tyt2y3 about 3 years ago

  • [[#152]] DatabaseConnection impl Clone
  • [[#175]] Impl TryGetableMany for diffrent types of generics
  • Codegen TimestampWithTimeZone fixup
sea-orm - 0.2.2

Published by tyt2y3 about 3 years ago

  • [[#105]] Compact entity format
  • [[#132]] Add ActiveModel insert & update
  • [[#129]] Add set method to UpdateMany
  • [[#118]] Initial lock support
  • [[#167]] Add FromQueryResult::find_by_statement
sea-orm - 0.2.1

Published by tyt2y3 about 3 years ago

  • Update dependencies
sea-orm - 0.2.0

Published by tyt2y3 about 3 years ago

  • [[#37]] Rocket example
  • [[#114]] log crate and env-logger
  • [[#103]] InsertResult to return the primary key's type
  • [[#89]] Represent several relations between same types by Linked
  • [[#59]] Transforming an Entity into TableCreateStatement
sea-orm - 0.1.3

Published by tyt2y3 about 3 years ago

  • [[#108]] Remove impl TryGetable for Option
sea-orm - 0.1.2

Published by tyt2y3 about 3 years ago

  • [[#68]] Added DateTimeWithTimeZone as supported attribute type
  • [[#70]] Generate arbitrary named entity
  • [[#80]] Custom column name
  • [[#81]] Support join on multiple columns
  • [[#99]] Implement FromStr for ColumnTrait
sea-orm - 0.1.1

Published by tyt2y3 about 3 years ago