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)
- [`b604fc9`](https://github.com/dani-garcia/vaultwarden/commit/b604fc9f98f8c3ffeae4b5a3889ebc69b9c4ad6c) 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>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/6437
Author: @Timshel
Created: 11/5/2025
Status: 🔄 Open
Base:
main← Head:upsert📝 Commits (1)
b604fc9Use 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_intowithinsert_intoto 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
OrgPolicytheuuidappears to be used when logging an event.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.