Run database migrations when opening board. Not when updating WeKan.

Thanks to xet7 !
This commit is contained in:
Lauri Ojansivu 2025-10-11 19:23:47 +03:00
parent ea30612013
commit 2b5c56484a
20 changed files with 2508 additions and 118 deletions

View file

@ -785,8 +785,13 @@ Boards.helpers({
{
boardId: this._id,
archived: false,
// Get lists for all swimlanes in this board
swimlaneId: { $in: this.swimlanes().map(s => s._id) },
// Get lists for all swimlanes in this board, plus lists without swimlaneId for backward compatibility
$or: [
{ swimlaneId: { $in: this.swimlanes().map(s => s._id) } },
{ swimlaneId: { $exists: false } },
{ swimlaneId: '' },
{ swimlaneId: null }
],
},
{ sort: sortKey },
);
@ -796,8 +801,13 @@ Boards.helpers({
return ReactiveCache.getLists(
{
boardId: this._id,
// Get lists for all swimlanes in this board
swimlaneId: { $in: this.swimlanes().map(s => s._id) }
// Get lists for all swimlanes in this board, plus lists without swimlaneId for backward compatibility
$or: [
{ swimlaneId: { $in: this.swimlanes().map(s => s._id) } },
{ swimlaneId: { $exists: false } },
{ swimlaneId: '' },
{ swimlaneId: null }
]
},
{ sort: { sort: 1 } }
);

View file

@ -50,10 +50,11 @@ Lists.attachSchema(
},
swimlaneId: {
/**
* the swimlane associated to this list. Required for per-swimlane list titles
* the swimlane associated to this list. Optional for backward compatibility
*/
type: String,
// Remove defaultValue to make it required
optional: true,
defaultValue: '',
},
createdAt: {
/**

View file

@ -211,20 +211,32 @@ Swimlanes.helpers({
},
newestLists() {
// sorted lists from newest to the oldest, by its creation date or its cards' last modification date
// Include lists without swimlaneId for backward compatibility (they belong to default swimlane)
return ReactiveCache.getLists(
{
boardId: this.boardId,
swimlaneId: this._id, // Only get lists that belong to this specific swimlane
$or: [
{ swimlaneId: this._id },
{ swimlaneId: { $exists: false } },
{ swimlaneId: '' },
{ swimlaneId: null }
],
archived: false,
},
{ sort: { modifiedAt: -1 } },
);
},
draggableLists() {
// Include lists without swimlaneId for backward compatibility (they belong to default swimlane)
return ReactiveCache.getLists(
{
boardId: this.boardId,
swimlaneId: this._id, // Only get lists that belong to this specific swimlane
$or: [
{ swimlaneId: this._id },
{ swimlaneId: { $exists: false } },
{ swimlaneId: '' },
{ swimlaneId: null }
],
//archived: false,
},
{ sort: ['sort'] },