mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-12-09 17:23:04 +03:00
Migrations cause Postgres warnings because SET CONSTRAINTS can only be used in transaction blocks #696
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?
Originally created by @spantaleev on GitHub.
Each time Vaultwarden starts, it runs its migrations and those trigger a Postgres warning (logged in the Postgres logs):
Deployment environment
Install method: Docker image
Clients used: irrelevant
Reverse proxy and version: irrelevant
MySQL/MariaDB or PostgreSQL version: PostgreSQL v16
Other relevant details:
I've found this code to be related:
bc26bfa589/src/db/mod.rs (L493)It doesn't seem like Vaultwarden is affected negatively by this, but it's probably something that should be looked into anyway.
Steps to reproduce
Restart Vaultwarden. On startup, it will run its migrations code and trigger this warning (found in the Postgres logs).
@stefan0xC commented on GitHub:
According to the comment preceding the statement (and the linked documentation)
bc26bfa589/src/db/mod.rs (L487-L492)it does not do anything outside a transaction, so it can be ignored.(And possible removed since
run_pending_migrationswill run each migration in its own transaction)