diff --git a/bin/upgrade/22.06/scripts/reset_upgraded_custom_dashboards.js b/bin/upgrade/22.06/scripts/reset_upgraded_custom_dashboards.js index 94c59bb63d7..06eb8e444d6 100644 --- a/bin/upgrade/22.06/scripts/reset_upgraded_custom_dashboards.js +++ b/bin/upgrade/22.06/scripts/reset_upgraded_custom_dashboards.js @@ -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 } } );