mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-30 21:37:47 -05:00
[PR #6279] [MERGED] Use Diesels MultiConnections Derive #7395
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/dani-garcia/vaultwarden/pull/6279
Author: @BlackDex
Created: 9/8/2025
Status: ✅ Merged
Merged: 10/29/2025
Merged by: @dani-garcia
Base:
main← Head:2025-diesel-multiconnect📝 Commits (8)
6e8af1bUse Diesels MultiConnections Derive666d6ceAdjust query_logger and some other small items522de62Remove macro, replaced with an functionfd03d78Implement custom connection managerbf559fdUpdated some crates to keep up2date9afad72Small adjustment4911484crate updatesd3c8d04Update crates📊 Changes
61 files changed (+3219 additions, -4213 deletions)
View changed files
📝
.github/workflows/build.yml(+3 -19)📝
.github/workflows/hadolint.yml(+1 -1)📝
.github/workflows/release.yml(+4 -4)📝
.github/workflows/trivy.yml(+2 -2)📝
.github/workflows/zizmor.yml(+1 -1)📝
Cargo.lock(+605 -652)📝
Cargo.toml(+30 -32)📝
build.rs(+0 -6)📝
docker/Dockerfile.alpine(+3 -3)📝
docker/Dockerfile.j2(+3 -3)📝
macros/Cargo.toml(+2 -2)📝
src/api/admin.rs(+99 -90)📝
src/api/core/accounts.rs(+128 -128)📝
src/api/core/ciphers.rs(+162 -183)📝
src/api/core/emergency_access.rs(+89 -83)📝
src/api/core/events.rs(+18 -23)📝
src/api/core/folders.rs(+19 -16)📝
src/api/core/mod.rs(+8 -10)📝
src/api/core/organizations.rs(+327 -348)📝
src/api/core/public.rs(+28 -25)...and 41 more files
📄 Description
With this PR we remove almost all custom macro's to create the multiple database type code. This is now handled by Diesel it self.
This removed the need of the following functions/macro's:
db_object!::to_db.from_db()It is also possible to just use one schema instead of multiple per type.
Also done:
connas mut inside eachdb_run!instead of having to declare it asmutin functions or callsACTIVE_DB_TYPEstatic which holds the currently active database typediesel_loggercrate and use Diesel'sset_default_instrumentation()If you want debug queries you can now simply change the log level of
vaultwarden::db::query_loggerdiesel_loggerisn't needed anymoreAnd on the extra plus-side, this lowers the compile-time and binary size too.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.