mirror of
https://github.com/wekan/wekan.git
synced 2025-09-22 01:50:48 +02:00
Add migration for swimlane addition
This commit is contained in:
parent
ee2a43dd5b
commit
ecb8c88233
1 changed files with 24 additions and 0 deletions
|
@ -151,3 +151,27 @@ Migrations.add('add-sort-checklists', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
Migrations.add('add-swimlanes', () => {
|
||||
Boards.find().forEach((board) => {
|
||||
const swimlane = Swimlanes.findOne({ boardId: board._id });
|
||||
let swimlaneId = '';
|
||||
if (swimlane)
|
||||
swimlaneId = swimlane._id
|
||||
else
|
||||
swimlaneId = Swimlanes.direct.insert({
|
||||
boardId: board._id,
|
||||
title: 'Default'
|
||||
});
|
||||
|
||||
Cards.find({ boardId: board._id }).forEach((card) => {
|
||||
if (!card.hasOwnProperty('swimlaneId')) {
|
||||
Cards.direct.update(
|
||||
{ _id: card._id },
|
||||
{ $set: { swimlaneId } },
|
||||
noValidate
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue