Browse Source

Attachments, ensure index of cardId exists

Martin Filser 3 years ago
parent
commit
6d5651e53f
2 changed files with 5 additions and 1 deletions
  1. 1 1
      models/attachments.js
  2. 4 0
      server/migrations.js

+ 1 - 1
models/attachments.js

@@ -83,7 +83,7 @@ if (Meteor.isServer) {
   });
   });
 
 
   Meteor.startup(() => {
   Meteor.startup(() => {
-    Attachments.collection._ensureIndex({ cardId: 1 });
+    Attachments.collection._ensureIndex({ 'meta.cardId': 1 });
     const storagePath = Attachments.storagePath();
     const storagePath = Attachments.storagePath();
     console.log("Meteor.startup check storagePath: ", storagePath);
     console.log("Meteor.startup check storagePath: ", storagePath);
     if (!fs.existsSync(storagePath)) {
     if (!fs.existsSync(storagePath)) {

+ 4 - 0
server/migrations.js

@@ -1276,3 +1276,7 @@ Migrations.add('migrate-avatars-collectionFS-to-ostrioFiles', () => {
     readStream.pipe(writeStream);
     readStream.pipe(writeStream);
   });
   });
 });
 });
+
+Migrations.add('migrate-attachment-drop-index-cardId', () => {
+  Attachments.collection._dropIndex({'cardId': 1});
+});