Skip to content

Commit

Permalink
change position unset condition in script
Browse files Browse the repository at this point in the history
  • Loading branch information
kanwarujjaval committed Jun 15, 2022
1 parent cd90e97 commit 882ccf0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bin/upgrade/22.06/scripts/reset_upgraded_custom_dashboards.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,23 @@ pluginManager.dbConnection().then(async (countlyDb) => {
});
}
if (doReset) {
/**
* Script ran on 22.03, which means upgrade is from 20.x
* the 22.03 sets gridsize at 4
* So we do not unset position for gridsize 4, since they are coming from 20.x
* The new script in 22.03 would not have run for users who are already on 22.03,
* so they would have gridsize 4 and need to unset the position
*/
await countlyDb.collection('widgets').updateMany(
{ gridsize: 4 },
{ gridsize: { $ne: 4 } },
{
$mul: { 'size.0': 3 },
$unset: { position: 1 },
$unset: { position: 1 }
}
);
await countlyDb.collection('widgets').updateMany(
{ gridsize: 4 },
{
$set: { gridsize: 12 }
}
);
Expand Down

0 comments on commit 882ccf0

Please sign in to comment.