We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8a8fff0 commit 04b816eCopy full SHA for 04b816e
migrations/20250819141206-add-updatedBy-from-createdBy.js
@@ -0,0 +1,29 @@
1
+const collections = [
2
+ "Attachment",
3
+ "Datablock",
4
+ "Dataset",
5
+ "Job",
6
+ "OrigDatablock",
7
+ "Policy",
8
+ "Proposal",
9
+ "PublishedData",
10
+ "Sample",
11
+];
12
+
13
14
+module.exports = {
15
+ async up(db, client) {
16
+ for (const collectionName of collections) {
17
+ await db
18
+ .collection(collectionName)
19
+ .updateMany(
20
+ { updatedBy: { $exists: false } },
21
+ [{ $set: { updatedBy: "$createdBy" } }]
22
+ );
23
+ }
24
+ },
25
26
+ async down(db, client) {
27
+ // No path backward as it's not easy to find on down where updatedBy was added
28
29
+};
0 commit comments