Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3490063
D5309.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
793 B
Referenced Files
None
Subscribers
None
D5309.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D5309: [keyserver] add script to populate `policy_acknowledgments` table
Attached
Detach File
Event Timeline
Log In to Comment