Page MenuHomePhabricator

[keyserver] add migration to populate `policy_acknowledgments` table
ClosedPublic

Authored by kamil on Nov 17 2022, 2:59 AM.
Tags
None
Referenced Files
F3489456: D5663.diff
Wed, Dec 18, 12:42 PM
Unknown Object (File)
Sun, Dec 15, 8:29 PM
Unknown Object (File)
Sun, Dec 15, 8:29 PM
Unknown Object (File)
Sun, Dec 15, 8:29 PM
Unknown Object (File)
Sun, Dec 15, 8:29 PM
Unknown Object (File)
Sun, Dec 15, 8:20 PM
Unknown Object (File)
Sat, Nov 30, 3:57 PM
Unknown Object (File)
Fri, Nov 22, 6:14 PM

Details

Summary

A solution suggested here: D5309#158058. Creates an entry for every already existing user.

Note: there are two users (ashoat and commbot) who will be present in the database on fresh creation and they will not have an entry in the acknowledgment_table but I am not sure if this is needed.

Test Plan
  1. Run migration
  2. this code should add rows to policy_acknowledgments for all users with terms of use policy, current time, and confirmed set to 1.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kamil held this revision as a draft.
kamil published this revision for review.Nov 17 2022, 3:05 AM
kamil edited the summary of this revision. (Show Details)
kamil edited the test plan for this revision. (Show Details)
kamil added reviewers: marcin, atul.
atul requested changes to this revision.Nov 17 2022, 11:24 AM
atul added a subscriber: ginsu.

Ran successfully for me:

8ddbaf.png (362×1 px, 89 KB)

Should be good to be accepted + landed once you've addressed the feedback (added a semicolon to the end of the SQL query).

IMPORTANT: (CC @ginsu) You guys are both working on adding migrations to migration-config so you'll need to coordinate to figure out who is landing what when + rebase as necessary. Will also need to make sure that all migrations have run in your local environment. If both of you have run a separate "migration 10" in your respective local environments your DB may get out of sync.
keyserver/src/database/migration-config.js
101 ↗(On Diff #18519)

Let's add a semicolon to the end of the query to match the rest of the queries in this file.

This revision now requires changes to proceed.Nov 17 2022, 11:24 AM
keyserver/src/database/migration-config.js
101 ↗(On Diff #18519)

I think we only need semicolons when multipleStatements: true

atul added inline comments.
keyserver/src/database/migration-config.js
101 ↗(On Diff #18519)

Makes sense, I'm just used to idea from whatever previous SQL dialect I used whenever that valid queries should end in semicolon + figured it'd be good to match rest of file... but yeah if it doesn't matter I'll accept this diff to unblock.

This revision is now accepted and ready to land.Nov 17 2022, 12:00 PM

rebase, update migration index

tomek added inline comments.
keyserver/src/database/migration-config.js
101 ↗(On Diff #18519)

For consistency reasons we should prefer having a semicolon here, but it's also fine to skip it.