[PR #6437] Use insert_into when possible #7415

Open
opened 2026-03-07 21:17:19 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/dani-garcia/vaultwarden/pull/6437
Author: @Timshel
Created: 11/5/2025
Status: 🔄 Open

Base: mainHead: upsert


📝 Commits (1)

  • a576a51 Use insert_into when possible

📊 Changes

13 files changed (+171 additions, -321 deletions)

View changed files

📝 src/api/core/accounts.rs (+1 -1)
📝 src/db/models/attachment.rs (+7 -15)
📝 src/db/models/auth_request.rs (+11 -19)
📝 src/db/models/cipher.rs (+7 -15)
📝 src/db/models/collection.rs (+30 -62)
📝 src/db/models/device.rs (+6 -3)
📝 src/db/models/emergency_access.rs (+7 -15)
📝 src/db/models/event.rs (+15 -12)
📝 src/db/models/folder.rs (+12 -21)
📝 src/db/models/group.rs (+39 -88)
📝 src/db/models/organization.rs (+21 -47)
📝 src/db/models/send.rs (+7 -15)
📝 src/db/models/user.rs (+8 -8)

📄 Description

Replace most replace_into with insert_into to avoid deleting a record to update it.

There is still two left :

But changing those would be more complex, the composite key could be used as primary instead of an uuid.
But at least for the OrgPolicy the uuid appears to be used when logging an event.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/dani-garcia/vaultwarden/pull/6437 **Author:** [@Timshel](https://github.com/Timshel) **Created:** 11/5/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `upsert` --- ### 📝 Commits (1) - [`a576a51`](https://github.com/dani-garcia/vaultwarden/commit/a576a51f82c835463dd2d8bd96e78853c152706b) Use insert_into when possible ### 📊 Changes **13 files changed** (+171 additions, -321 deletions) <details> <summary>View changed files</summary> 📝 `src/api/core/accounts.rs` (+1 -1) 📝 `src/db/models/attachment.rs` (+7 -15) 📝 `src/db/models/auth_request.rs` (+11 -19) 📝 `src/db/models/cipher.rs` (+7 -15) 📝 `src/db/models/collection.rs` (+30 -62) 📝 `src/db/models/device.rs` (+6 -3) 📝 `src/db/models/emergency_access.rs` (+7 -15) 📝 `src/db/models/event.rs` (+15 -12) 📝 `src/db/models/folder.rs` (+12 -21) 📝 `src/db/models/group.rs` (+39 -88) 📝 `src/db/models/organization.rs` (+21 -47) 📝 `src/db/models/send.rs` (+7 -15) 📝 `src/db/models/user.rs` (+8 -8) </details> ### 📄 Description Replace most `replace_into` with `insert_into` to avoid deleting a record to update it. There is still two left : - [org_policy.rs#L130](https://github.com/dani-garcia/vaultwarden/blob/9017ca265a28ff1370e6047b8e85c0a6c3327306/src/db/models/org_policy.rs#L130) - [two_factor.rs#L99](https://github.com/dani-garcia/vaultwarden/blob/9017ca265a28ff1370e6047b8e85c0a6c3327306/src/db/models/two_factor.rs#L99) But changing those would be more complex, the composite key could be used as primary instead of an `uuid`. But at least for the `OrgPolicy` the `uuid` appears to be used when logging an event. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-07 21:17:19 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vaultwarden#7415