diff --git a/bin/upgrade/22.03/upgrade_db.sh b/bin/upgrade/22.03/upgrade_db.sh index e3de6d44ede..673660fe699 100644 --- a/bin/upgrade/22.03/upgrade_db.sh +++ b/bin/upgrade/22.03/upgrade_db.sh @@ -54,6 +54,7 @@ then nodejs "$CUR/scripts/remove_old_flows_collections.js" nodejs "$CUR/scripts/update_widgets_reports.js" nodejs "$CUR/scripts/clear_old_report_data.js" + nodejs "$CUR/scripts/mark_upgraded_custom_dashboards.js" #change config settings countly config "api.batch_on_master" null --force 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 } } );