diff options
author | Andrés Manelli <andresmanelli@gmail.com> | 2018-01-22 15:10:26 -0300 |
---|---|---|
committer | Andrés Manelli <andresmanelli@gmail.com> | 2018-01-22 15:10:26 -0300 |
commit | ecb8c8823358c91e00868e559c0fbaf256e9eb9d (patch) | |
tree | f2075d23312348fc25aac86f0752691c577a6baf | |
parent | ee2a43dd5b4b5296f61f68b46fd85521224f571d (diff) | |
download | wekan-ecb8c8823358c91e00868e559c0fbaf256e9eb9d.tar.gz wekan-ecb8c8823358c91e00868e559c0fbaf256e9eb9d.tar.bz2 wekan-ecb8c8823358c91e00868e559c0fbaf256e9eb9d.zip |
Add migration for swimlane addition
-rw-r--r-- | server/migrations.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/server/migrations.js b/server/migrations.js index f828a14c..932a3cfd 100644 --- a/server/migrations.js +++ b/server/migrations.js @@ -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 + ); + } + }); + }); +}); |