From a929d1e3a4bb6d8daf1f34b131a09addfa452af6 Mon Sep 17 00:00:00 2001 From: Martin Filser Date: Fri, 17 Mar 2023 21:31:18 +0100 Subject: [PATCH] reducing card size in database if no planning poker was started reducing: - cards collection size - database size - size to transfer from server to client (publish / subscribe) --- models/cards.js | 15 ++------------- server/migrations.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/models/cards.js b/models/cards.js index cfc41d322..5e9fffddc 100644 --- a/models/cards.js +++ b/models/cards.js @@ -351,7 +351,7 @@ Cards.attachSchema( }, 'poker.question': { type: Boolean, - defaultValue: false, + optional: true, }, 'poker.one': { /** @@ -359,7 +359,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.two': { /** @@ -367,7 +366,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.three': { /** @@ -375,7 +373,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.five': { /** @@ -383,7 +380,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.eight': { /** @@ -391,7 +387,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.thirteen': { /** @@ -399,7 +394,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.twenty': { /** @@ -407,7 +401,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.forty': { /** @@ -415,7 +408,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.oneHundred': { /** @@ -423,7 +415,6 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.unsure': { /** @@ -431,16 +422,14 @@ Cards.attachSchema( */ type: [String], optional: true, - defaultValue: [], }, 'poker.end': { type: Date, optional: true, - defaultValue: null, }, 'poker.allowNonBoardMembers': { type: Boolean, - defaultValue: false, + optional: true, }, 'poker.estimation': { /** diff --git a/server/migrations.js b/server/migrations.js index b58c6f9d7..f0b09b61e 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -1443,3 +1443,17 @@ Migrations.add('attachment-cardCopy-fix-boardId-etc', () => { }); }); */ + +Migrations.add('remove-unused-planning-poker', () => { + Cards.update( + { + "poker.question": false, + }, + { + $unset: { + "poker": 1, + }, + }, + noValidateMulti, + ); +});