mirror of
https://github.com/wekan/wekan.git
synced 2025-04-20 12:07:11 -04: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,13 +1425,15 @@ Migrations.add('attachment-cardCopy-fix-boardId-etc', () => {
|
|||
Attachments.find( {"meta.source": "copy"} ).forEach(_attachment => {
|
||||
const cardId = _attachment.meta.cardId;
|
||||
const card = Cards.findOne(cardId);
|
||||
console.log("update attachment id: ", _attachment._id);
|
||||
Attachments.update(_attachment._id, {
|
||||
$set: {
|
||||
"meta.boardId": card.boardId,
|
||||
"meta.listId": card.listId,
|
||||
"meta.swimlaneId": card.swimlaneId,
|
||||
}
|
||||
});
|
||||
if (card.boardId && card.listId && card.swimlaneId) {
|
||||
console.log("update attachment id: ", _attachment._id);
|
||||
Attachments.update(_attachment._id, {
|
||||
$set: {
|
||||
"meta.boardId": card.boardId,
|
||||
"meta.listId": card.listId,
|
||||
"meta.swimlaneId": card.swimlaneId,
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue