Skip to content

Commit

Permalink
Fixed issue #17608: Remove orphan labels before adding table unique c…
Browse files Browse the repository at this point in the history
…onstraint
  • Loading branch information
olleharstedt committed Sep 22, 2021
1 parent a2dea27 commit 022518d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -8060,6 +8060,14 @@ function regenerateLabelCodes400(int $lid, $hasLanguageColumn = true)
sprintf("SELECT * FROM {{labelsets}} WHERE lid = %d", (int) $lid)
)->queryRow();
if (empty($labelSet)) {
// No belonging label set, remove orphan labels.
// @see https://bugs.limesurvey.org/view.php?id=17608
$oDB->createCommand(
sprintf(
'DELETE FROM {{labels}} WHERE lid = %d',
(int) $lid
)
)->execute();
return;
}

Expand Down

0 comments on commit 022518d

Please sign in to comment.