diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-09-23 11:21:22 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2025-09-23 11:21:22 +0200 |
| commit | 7c79dab1970770fc69deabb17ac108c82e7d6f3b (patch) | |
| tree | bcb45373d13bc39226ce58ba41df2cb15efc3b8d /db | |
| parent | 349521e801bea9a07f1b8ec1b3261cf9077e3788 (diff) | |
set parent_id to null when deleting wiki pages and add migration that fixes invalid entries, fixes #5832
Closes #5832
Merge request studip/studip!4447
Diffstat (limited to 'db')
| -rw-r--r-- | db/migrations/5.5.35_cleanup_wiki_page_parent_id.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/migrations/5.5.35_cleanup_wiki_page_parent_id.php b/db/migrations/5.5.35_cleanup_wiki_page_parent_id.php new file mode 100644 index 0000000..a374429 --- /dev/null +++ b/db/migrations/5.5.35_cleanup_wiki_page_parent_id.php @@ -0,0 +1,18 @@ +<?php +final class CleanupWikiPageParentId extends Migration +{ + public function description() + { + return 'Remove invalid parent_id from wiki_pages'; + } + + protected function up() + { + $query = "UPDATE `wiki_pages` AS w0 + LEFT JOIN `wiki_pages` AS w1 + ON (w0.`parent_id` = w1.`page_id`) + SET w0.`parent_id` = NULL + WHERE w1.`page_id` IS NULL"; + DBManager::get()->execute($query); + } +} |
