-
Notifications
You must be signed in to change notification settings - Fork 1.6k
UUID type for hydra_jwk primary key #2788
Description
Is your feature request related to a problem? Please describe.
Currently, the primary key of the hydra_jwk table is an integer sequence. Since we don't benefit from the guarantees that a sequence provides, it would be better to just use UUID, to reduce insert complexity[1] and avoid other potential issues[2].
Additional context
The primary key is not used in foreign keys, so it can be changed with minimal disruption in cockroachdb, mysql, and postgres. sqlite requires the table to be recreated.
This change will involve generating new primary keys in application code rather than in the DB because we would like to minimize the work done by the database and it is the standard practice. The migration, however, requires that we generate UUIDs for existing rows.
Describe the solution you'd like
Change hydra_jwk primary key to UUID while making it possible to revert the change and without imposing any new configuration requirements such as the postgres UUID extension. It is not required for this migration to be online.
Describe alternatives you've considered
n/a
[1] https://www.cockroachlabs.com/docs/stable/create-sequence.html#considerations
[2] #2765