-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/master' into add-metadata-types-endpoint
- Loading branch information
Showing
32 changed files
with
1,266 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
module.exports = { | ||
async up(db, client) { | ||
// TODO write your migration here. | ||
// See https://github.com/seppevs/migrate-mongo/#creating-a-new-migration-script | ||
// Example: | ||
// await db.collection('albums').updateOne({artist: 'The Beatles'}, {$set: {blacklisted: true}}); | ||
await db.collection("Dataset").updateMany({}, [ | ||
{ | ||
$set: { | ||
proposalIds: ["$proposalId"], | ||
instrumentIds: ["$instrumentId"], | ||
sampleIds: ["$sampleId"], | ||
}, | ||
}, | ||
]); | ||
await db.collection("Dataset").updateMany({ type: "derived" }, [ | ||
{ | ||
$set: { | ||
principalInvestigator: "$investigator", | ||
}, | ||
}, | ||
]); | ||
}, | ||
|
||
async down(db, client) { | ||
// TODO write the statements to rollback your migration (if possible) | ||
// Example: | ||
// await db.collection('albums').updateOne({artist: 'The Beatles'}, {$set: {blacklisted: false}}); | ||
|
||
await db.collection("Dataset").updateMany({}, [ | ||
{ | ||
$set: { | ||
proposalId: "$proposalIds[0]", | ||
instrumentId: "$instrumentId[0]", | ||
sampleId: "$sampleId[0]", | ||
}, | ||
}, | ||
]); | ||
await db.collection("Dataset").updateMany({ type: "derived" }, [ | ||
{ | ||
$set: { | ||
investigator: "$principalInvestigator", | ||
}, | ||
}, | ||
]); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.