π We are pleased to release SeaORM 0.8.0
today! Here are some feature highlights π:
Migration Utilities Moved to sea-orm-migration
crate
[#666] Utilities of SeaORM migration have been moved from sea-schema
to sea-orm-migration
crate. Users are advised to upgrade from older versions with the following steps:
- Bump
sea-orm
version to0.8.0
. -
Replace
sea-schema
dependency withsea-orm-migration
in yourmigration
crate.
```diff title=migration/Cargo.toml
[dependencies]- sea-schema = { version = "^0.7.0", ... }
- sea-orm-migration = { version = "^0.8.0" } ```
-
Find and replace
use sea_schema::migration::
withuse sea_orm_migration::
in yourmigration
crate.
- use sea_schema::migration::prelude::*; + use sea_orm_migration::prelude::*; - use sea_schema::migration::*; + use sea_orm_migration::*;
Designed by:
Contributed by:
Generating New Migration
[#656] You can create a new migration with the migrate generate
subcommand. This simplifies the migration process, as new migrations no longer need to be added manually.
# A migration file `MIGRATION_DIR/src/mYYYYMMDD_HHMMSS_create_product_table.rs` will be created.
# And, the migration file will be imported and included in the migrator located at `MIGRATION_DIR/src/lib.rs`.
sea-orm-cli migrate generate create_product_table
Proposed & Contributed by:
Inserting One with Default
[#589] Insert a row populate with default values. Note that the target table should have default values defined for all of its columns.
let pear = fruit::ActiveModel {
..Default::default() // all attributes are `NotSet`
};
// The SQL statement:
// - MySQL: INSERT INTO `fruit` VALUES ()
// - SQLite: INSERT INTO "fruit" DEFAULT VALUES
// - PostgreSQL: INSERT INTO "fruit" VALUES (DEFAULT) RETURNING "id", "name", "cake_id"
let pear: fruit::Model = pear.insert(db).await?;
Proposed by:
Contributed by:
Checking if an ActiveModel
is changed
[#683] You can check whether any field in an ActiveModel
is Set
with the help of the is_changed
method.
let mut fruit: fruit::ActiveModel = Default::default();
assert!(!fruit.is_changed());
fruit.set(fruit::Column::Name, "apple".into());
assert!(fruit.is_changed());
Proposed by:
Contributed by:
Minor Improvements
- [#670] Add
max_connections
option tosea-orm-cli generate entity
subcommand - [#677] Derive
Eq
andClone
forDbErr
Proposed & Contributed by:
Integration Examples
SeaORM plays well with the other crates in the async ecosystem. It can be integrated easily with common RESTful frameworks and also gRPC frameworks; check out our new Tonic example to see how it works. More examples wanted!
- Rocket Example
- Actix Example
- Axum Example
- Poem Example
- GraphQL Example
- jsonrpsee Example
- Tonic Example
Who's using SeaORM?
The following products are powered by SeaORM:
- Caido: A lightweight web security auditing toolkit
- Sensei: A Bitcoin lightning node implementation
- Svix: The enterprise ready webhooks service
SeaORM is the foundation of StarfishQL, an experimental graph database and query engine.
For more projects, see Built with SeaORM.
Sponsor
Our GitHub Sponsor profile is up! If you feel generous, a small donation will be greatly appreciated.
A big shout out to our sponsors π:
- Γmile Fugulin
- Zachary Vander Velden
- Dean Sheather
- Shane Sveller
- Sakti Dwi Cahyono
- Unnamed Sponsor
Community
SeaQL is a community driven project. We welcome you to participate, contribute and together build for Rust's future.
Here is the roadmap for SeaORM 0.9.x
.
GSoC 2022
We are super excited to be selected as a Google Summer of Code 2022 mentor organization. The application is now closed, but the program is about to start! If you have thoughts over how we are going to implement the project ideas, feel free to participate in the discussion.
Top comments (2)
Very exciting! I haven't checked out the project since migrations were released, so I'm quite excited for this!
Thanks for the supports!