Skip to content

Commit 965c397

Browse files
authored
Fix evolution 158 (as it was run)
The update only updates multiUsers that have at least one user. If a multiUser exists with no associated user (e.g. the account was deleted but the multiUser row remains), that multiUser row never gets its firstName/lastName set, leaving them NULL. To handle this case, we explicitly set those multiusers’ names to "<deleted>".
1 parent 3f7e4a4 commit 965c397

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

schema/evolutions/158-move-names-to-multiusers.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ SET firstName = u.firstName, lastName = u.lastName
1414
FROM webknossos.users u
1515
WHERE u._multiUser = m._id;
1616

17+
UPDATE webknossos.multiUsers SET firstName = '<deleted>', lastName = '<deleted>' WHERE firstName IS NULL;
18+
1719
ALTER TABLE webknossos.multiUsers ALTER COLUMN firstName SET NOT NULL;
1820
ALTER TABLE webknossos.multiUsers ALTER COLUMN lastName SET NOT NULL;
1921

0 commit comments

Comments
 (0)