aboutsummaryrefslogtreecommitdiff
path: root/src/db/models/send.rs
diff options
context:
space:
mode:
authorBlackDex <[email protected]>2022-05-04 21:13:05 +0200
committerBlackDex <[email protected]>2022-05-06 17:01:02 +0200
commit3ca85028ea99ed43c99847b18e222f25ca47374e (patch)
tree4a0c9369911ee87f9827201af180a63d63ce340a /src/db/models/send.rs
parent3abf173d8954c982383285b29b39d15043e974cb (diff)
downloadvaultwarden-3ca85028ea99ed43c99847b18e222f25ca47374e.tar.gz
vaultwarden-3ca85028ea99ed43c99847b18e222f25ca47374e.zip
Improve sync speed and updated dep. versions
Improved sync speed by resolving the N+1 query issues. Solves #1402 and Solves #1453 With this change there is just one query done to retreive all the important data, and matching is done in-code/memory. With a very large database the sync time went down about 3 times. Also updated misc crates and Github Actions versions.
Diffstat (limited to 'src/db/models/send.rs')
-rw-r--r--src/db/models/send.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/db/models/send.rs b/src/db/models/send.rs
index cc8fd4fa..8fff5143 100644
--- a/src/db/models/send.rs
+++ b/src/db/models/send.rs
@@ -1,14 +1,12 @@
use chrono::{NaiveDateTime, Utc};
use serde_json::Value;
-use super::{Organization, User};
+use super::User;
db_object! {
- #[derive(Identifiable, Queryable, Insertable, Associations, AsChangeset)]
+ #[derive(Identifiable, Queryable, Insertable, AsChangeset)]
#[table_name = "sends"]
#[changeset_options(treat_none_as_null="true")]
- #[belongs_to(User, foreign_key = "user_uuid")]
- #[belongs_to(Organization, foreign_key = "organization_uuid")]
#[primary_key(uuid)]
pub struct Send {
pub uuid: String,