-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2994 from clari182/feature/implicated-systems
Feature/implicated systems
- Loading branch information
Showing
73 changed files
with
4,398 additions
and
3,925 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
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
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
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
77 changes: 77 additions & 0 deletions
77
site/gatsby-site/migrations/2024.07.25T14.51.08.set-implicated-systems.js
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,77 @@ | ||
const config = require('../config'); | ||
/** | ||
* | ||
* @param {{context: {client: import('mongodb').MongoClient}}} context | ||
*/ | ||
|
||
exports.up = async ({ context: { client } }) => { | ||
await client.connect(); | ||
|
||
// New implicated_systems field on submissions and incidents collections from production db and history db | ||
|
||
const submissionsCollection = client | ||
.db(config.realm.production_db.db_name) | ||
.collection('submissions'); | ||
|
||
const submissionsHistoryCollection = client | ||
.db(config.realm.production_db.db_history_name) | ||
.collection('submissions'); | ||
|
||
const incidentsCollection = client.db(config.realm.production_db.db_name).collection('incidents'); | ||
|
||
const incidentsHistoryCollection = client | ||
.db(config.realm.production_db.db_history_name) | ||
.collection('incidents'); | ||
|
||
const submissionsUpdates = await submissionsCollection.updateMany( | ||
{}, | ||
{ | ||
$set: { | ||
implicated_systems: [], | ||
}, | ||
} | ||
); | ||
|
||
console.log( | ||
`Updated ${submissionsUpdates.modifiedCount} submissions with new implicated_systems field` | ||
); | ||
|
||
const submissionsHistoryUpdates = await submissionsHistoryCollection.updateMany( | ||
{}, | ||
{ | ||
$set: { | ||
implicated_systems: [], | ||
}, | ||
} | ||
); | ||
|
||
console.log( | ||
`Updated ${submissionsHistoryUpdates.modifiedCount} submissions history with new created_at field` | ||
); | ||
|
||
const incidentsUpdates = await incidentsCollection.updateMany( | ||
{}, | ||
{ | ||
$set: { | ||
implicated_systems: [], | ||
}, | ||
} | ||
); | ||
|
||
console.log( | ||
`Updated ${incidentsUpdates.modifiedCount} incidents with new implicated_systems field` | ||
); | ||
|
||
const incidentsHistoryUpdates = await incidentsHistoryCollection.updateMany( | ||
{}, | ||
{ | ||
$set: { | ||
implicated_systems: [], | ||
}, | ||
} | ||
); | ||
|
||
console.log( | ||
`Updated ${incidentsHistoryUpdates.modifiedCount} incidents history with new created_at field` | ||
); | ||
}; |
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.