We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d2ed5a commit f020cceCopy full SHA for f020cce
crates/storage-pg/migrations/20251023134634_personal_access_tokens_unique_fix.sql
@@ -0,0 +1,14 @@
1
+-- Copyright 2025 Element Creations Ltd.
2
+--
3
+-- SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
4
+-- Please see LICENSE in the repository root for full details.
5
+
6
7
+-- Fix a faulty constraint.
8
+-- The condition was incorrectly specified as `revoked_at IS NOT NULL`
9
+-- when `revoked_at IS NULL` was meant.
10
11
+DROP INDEX personal_access_tokens_personal_session_id_idx;
12
13
+-- Ensure we can only have one active personal access token in each family.
14
+CREATE UNIQUE INDEX ON personal_access_tokens (personal_session_id) WHERE revoked_at IS NULL;
0 commit comments