mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 18:00:12 +01:00
fix for migration "attachment-cardCopy-fix-boardId-etc"
- every card must have a boardId, listId and swimlaneId, if not, the database data is corrupt, but the migration should also not break wekan from startup
This commit is contained in:
parent
08a3506f12
commit
6ad007a5f1
1 changed files with 10 additions and 8 deletions
|
|
@ -1425,6 +1425,7 @@ Migrations.add('attachment-cardCopy-fix-boardId-etc', () => {
|
||||||
Attachments.find( {"meta.source": "copy"} ).forEach(_attachment => {
|
Attachments.find( {"meta.source": "copy"} ).forEach(_attachment => {
|
||||||
const cardId = _attachment.meta.cardId;
|
const cardId = _attachment.meta.cardId;
|
||||||
const card = Cards.findOne(cardId);
|
const card = Cards.findOne(cardId);
|
||||||
|
if (card.boardId && card.listId && card.swimlaneId) {
|
||||||
console.log("update attachment id: ", _attachment._id);
|
console.log("update attachment id: ", _attachment._id);
|
||||||
Attachments.update(_attachment._id, {
|
Attachments.update(_attachment._id, {
|
||||||
$set: {
|
$set: {
|
||||||
|
|
@ -1433,5 +1434,6 @@ Migrations.add('attachment-cardCopy-fix-boardId-etc', () => {
|
||||||
"meta.swimlaneId": card.swimlaneId,
|
"meta.swimlaneId": card.swimlaneId,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue