HomePhabricator
Diffusion Comm 14e7077b61e5

[keyserver] add migration to create `policy_acknowledgments` table

Tags
None
Referenced Files
F192514: image.png
Nov 22 2022, 6:33 AM
File Not Attached
Subscribers
None

Description

[keyserver] add migration to create policy_acknowledgments table

Summary:
Add the table to track user acknowledgments.

Table structure was described in ENG-1868.

Table using only primary key with two columns - (user, policy) and user is in first place on purpose.
A lot of queries will be performed on this table based on the user id. InnoDB by default will use BTREE as indexing algorithm which works fine for this approach (keep rows sorted based on user ID and should be decent).
I also did a test with added additional index only for user column a perform some queries on table with ~900 rows and ~400 users, measured times were almost equal on both approaches so I think there is no need for another index (might waster some resources) and primary key with pair (user, policy) should be sufficient.

Test Plan:

  1. Restart the keyserver
  2. Check in metadata table if the database version was incremented.
  3. Check if policy_acknowledgments was created with proper structure, screenshot with table:

image.png (364×835 px, 40 KB)

Reviewers: atul, marcin, ashoat, tomek

Reviewed By: atul, marcin, ashoat, tomek

Subscribers: tomek, ashoat, atul, abosh

Differential Revision: https://phab.comm.dev/D5307

Details

Provenance
kamilAuthored on Nov 16 2022, 6:26 AM
Reviewer
atul
Differential Revision
D5307: [keyserver] add migration to create `policy_acknowledgments` table
Parents
rCOMM06f3ea0cc42a: [lib] add legal policies list
Branches
Unknown
Tags
Unknown