add cardNumber handling to card and board model

This commit is contained in:
Kai Lehmann 2021-08-02 21:41:30 +02:00
parent 36c2cb9573
commit b57eae14d4
3 changed files with 72 additions and 0 deletions

View file

@ -1061,3 +1061,36 @@ Migrations.add('add-hide-logo-by-default', () => {
noValidateMulti,
);
});
Migrations.add('add-card-number-allowed', () => {
Boards.update(
{
allowsCardNumber: {
$exists: false,
},
},
{
$set: {
allowsCardNumber: false,
},
},
noValidateMulti,
);
});
Migrations.add('assign-boardwise-card-numbers', () => {
Boards.find().forEach(board => {
let nextCardNumber = 1;
Cards.find(
{
boardId: board._id,
cardNumber: {
$exists: false
}
}
).forEach(card => {
Cards.update(card._id, { $set: { cardNumber } }, noValidate);
nextCardNumber++;
});
})
});