Use insert_into when possible #296

Open
opened 2026-04-05 20:48:50 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @Timshel on 11/5/2025

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.

*Originally created by @Timshel on 11/5/2025* 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.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/vaultwarden#296