This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(1.5.0): Add script to clean useless data
Clsoes gravitee-io/issues#504
- Loading branch information
Showing
3 changed files
with
27 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
= Upgrade to 1.5.0 | ||
|
||
== Repository | ||
=== Mongodb | ||
|
||
Before running any script, please create a dump of your existing database. | ||
|
||
upgrades/1.5.0/mongodb/1-remove-event-picture.js:: | ||
This script delete the picture from all API relative events because picture is useless and is disk consuming. |
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,14 @@ | ||
db.events.find().forEach( | ||
function(event) { | ||
var payload = JSON.parse(event.payload); | ||
if (payload.definition !== undefined) { | ||
var definition = JSON.parse(payload.definition); | ||
delete payload.picture; | ||
delete definition.picture; | ||
|
||
payload.definition = JSON.stringify(definition); | ||
|
||
db.events.updateOne({ _id: event._id}, {$set: {payload: JSON.stringify(payload)}}, { upsert: true} ); | ||
} | ||
} | ||
); |
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