mirror of
https://github.com/Phundrak/georm.git
synced 2026-07-29 04:19:18 +02:00
feat: deprecate create_or_update in favour of upsert
The `create_or_update` method has been deprecated and replaced by `upsert` for clarity and consistency with common database terminology. This commit also removes the file `src/entity.rs` which has been forgotten in earlier commits and was no longer part of Georm.
This commit is contained in:
@@ -115,7 +115,7 @@ async fn should_create_if_does_not_exist(pool: sqlx::PgPool) -> sqlx::Result<()>
|
||||
name: "Miura Kentaro".into(),
|
||||
..Default::default()
|
||||
};
|
||||
author.create_or_update(&pool).await?;
|
||||
author.upsert(&pool).await?;
|
||||
let all_authors = Author::find_all(&pool).await?;
|
||||
assert_eq!(1, all_authors.len());
|
||||
Ok(())
|
||||
@@ -130,7 +130,7 @@ async fn should_update_if_exist(pool: sqlx::PgPool) -> sqlx::Result<()> {
|
||||
name: "Miura Kentaro".into(),
|
||||
..Default::default()
|
||||
};
|
||||
author.create_or_update(&pool).await?;
|
||||
author.upsert(&pool).await?;
|
||||
let mut all_authors = Author::find_all(&pool).await?;
|
||||
all_authors.sort();
|
||||
assert_eq!(3, all_authors.len());
|
||||
|
||||
Reference in New Issue
Block a user