mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-10 01:10:09 +03:00
[PR #6279] Use Diesels MultiConnections Derive #2424
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: 🔄 Open
Base:
main← Head:2025-diesel-multiconnect📝 Commits (6)
03aa7e5Use Diesels MultiConnections Derivee58d64fAdjust query_logger and some other small items02af16bRemove macro, replaced with an function7763042Implement custom connection manager78c8fd3Updated some crates to keep up2date65b119fSmall adjustment📊 Changes
61 files changed (+3069 additions, -4009 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(+468 -462)📝
Cargo.toml(+19 -21)📝
build.rs(+0 -6)📝
docker/Dockerfile.alpine(+3 -3)📝
docker/Dockerfile.j2(+3 -3)📝
macros/Cargo.toml(+1 -1)📝
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.