Page MenuHomePhabricator

D5309.diff
No OneTemporary

D5309.diff

diff --git a/keyserver/src/scripts/populate-policies-acknowledgment.js b/keyserver/src/scripts/populate-policies-acknowledgment.js
new file mode 100644
--- /dev/null
+++ b/keyserver/src/scripts/populate-policies-acknowledgment.js
@@ -0,0 +1,18 @@
+// @flow
+
+import { dbQuery, SQL } from '../database/database.js';
+import { policyTypes } from '../lib/facts/policies.js';
+import { main } from './utils.js';
+
+// this function populate accepted policy for existing users
+async function populatePoliciesAcknowledgment() {
+ const time = Date.now();
+
+ await dbQuery(SQL`
+ INSERT IGNORE INTO policy_acknowledgments (policy, user, date, confirmed)
+ SELECT ${policyTypes.tosAndPrivacyPolicy}, id, ${time}, 1
+ FROM users;
+ `);
+}
+
+main([populatePoliciesAcknowledgment]);

File Metadata

Mime Type
text/plain
Expires
Thu, Dec 19, 2:44 PM (20 h, 44 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2677722
Default Alt Text
D5309.diff (793 B)

Event Timeline