summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrés Manelli <andresmanelli@gmail.com>2018-01-22 15:10:26 -0300
committerAndrés Manelli <andresmanelli@gmail.com>2018-01-22 15:10:26 -0300
commitecb8c8823358c91e00868e559c0fbaf256e9eb9d (patch)
treef2075d23312348fc25aac86f0752691c577a6baf
parentee2a43dd5b4b5296f61f68b46fd85521224f571d (diff)
downloadwekan-ecb8c8823358c91e00868e559c0fbaf256e9eb9d.tar.gz
wekan-ecb8c8823358c91e00868e559c0fbaf256e9eb9d.tar.bz2
wekan-ecb8c8823358c91e00868e559c0fbaf256e9eb9d.zip
Add migration for swimlane addition
-rw-r--r--server/migrations.js24
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
+ );
+ }
+ });
+ });
+});