Browse Source

Fix opening board migration of Shared Lists to Per-Swimlane lists to use ReactiveCache correctly without errors.

Thanks to xet7 !

Fixes #5960
Lauri Ojansivu 1 day ago
parent
commit
9536e60bd1
1 changed files with 6 additions and 3 deletions
  1. 6 3
      server/migrations/fixMissingListsMigration.js

+ 6 - 3
server/migrations/fixMissingListsMigration.js

@@ -18,6 +18,9 @@
 import { Meteor } from 'meteor/meteor';
 import { Meteor } from 'meteor/meteor';
 import { check } from 'meteor/check';
 import { check } from 'meteor/check';
 import { ReactiveCache } from '/imports/reactiveCache';
 import { ReactiveCache } from '/imports/reactiveCache';
+import Boards from '/models/boards';
+import Lists from '/models/lists';
+import Cards from '/models/cards';
 
 
 class FixMissingListsMigration {
 class FixMissingListsMigration {
   constructor() {
   constructor() {
@@ -158,7 +161,7 @@ class FixMissingListsMigration {
             if (originalList.collapsed) newListData.collapsed = originalList.collapsed;
             if (originalList.collapsed) newListData.collapsed = originalList.collapsed;
 
 
             // Insert the new list
             // Insert the new list
-            const newListId = ReactiveCache.getCollection('lists').insert(newListData);
+            const newListId = Lists.insert(newListData);
             targetList = { _id: newListId, ...newListData };
             targetList = { _id: newListId, ...newListData };
             createdLists++;
             createdLists++;
             
             
@@ -167,7 +170,7 @@ class FixMissingListsMigration {
 
 
           // Update all cards in this group to use the correct listId
           // Update all cards in this group to use the correct listId
           for (const card of cardsInList) {
           for (const card of cardsInList) {
-            ReactiveCache.getCollection('cards').update(card._id, {
+            Cards.update(card._id, {
               $set: {
               $set: {
                 listId: targetList._id,
                 listId: targetList._id,
                 modifiedAt: new Date()
                 modifiedAt: new Date()
@@ -179,7 +182,7 @@ class FixMissingListsMigration {
       }
       }
 
 
       // Mark board as processed
       // Mark board as processed
-      ReactiveCache.getCollection('boards').update(boardId, {
+      Boards.update(boardId, {
         $set: {
         $set: {
           fixMissingListsCompleted: true,
           fixMissingListsCompleted: true,
           fixMissingListsCompletedAt: new Date()
           fixMissingListsCompletedAt: new Date()