From a8e5384c4ab944afb469f5f9a0ac89be0f68f573 Mon Sep 17 00:00:00 2001 From: BlackDex Date: Mon, 10 Jul 2023 15:29:06 +0200 Subject: [PATCH] Fix Org API Key generation on PosgreSQL Using PostgreSQL creating or rotating the Org API Key failed because of some query mismatch. This PR fixes that. Fixes https://github.com/dani-garcia/vaultwarden/discussions/3671#discussioncomment-6400394 --- src/db/models/organization.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db/models/organization.rs b/src/db/models/organization.rs index 5d1f0af2..60660f7f 100644 --- a/src/db/models/organization.rs +++ b/src/db/models/organization.rs @@ -804,7 +804,7 @@ impl OrganizationApiKey { let value = OrganizationApiKeyDb::to_db(self); diesel::insert_into(organization_api_key::table) .values(&value) - .on_conflict(organization_api_key::uuid) + .on_conflict((organization_api_key::uuid, organization_api_key::org_uuid)) .do_update() .set(&value) .execute(conn)