diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2026-03-10 12:29:54 +0100 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2026-03-10 12:30:52 +0100 |
| commit | a7a54bfc800f5440d6c7e7ab4af9b7d169edc40c (patch) | |
| tree | 6af09927684d5c802a2c3fb2292d597dd3502d85 | |
| parent | 15697a0458796f0c12619a0967512afba526611f (diff) | |
add migration that fixes the pk for table files_search_index, fixes #6184
Closes #6184
Merge request studip/studip!4691
| -rw-r--r-- | db/migrations/5.4.23_fix_files_search_index_pk.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/db/migrations/5.4.23_fix_files_search_index_pk.php b/db/migrations/5.4.23_fix_files_search_index_pk.php new file mode 100644 index 0000000..874e245 --- /dev/null +++ b/db/migrations/5.4.23_fix_files_search_index_pk.php @@ -0,0 +1,30 @@ +<?php +/** + * @see https://gitlab.studip.de/studip/studip/-/issues/6184 + */ +final class FixFilesSearchIndexPk extends Migration +{ + use DatabaseMigrationTrait; + + public function description() + { + return 'Add PK id to files_search_index and remove explicit FTS_DOC_ID if present'; + } + + protected function up() + { + if ($this->columnExists('files_search_index', 'FTS_DOC_ID')) { + DBManager::get()->exec( + "ALTER TABLE `files_search_index` + DROP COLUMN `FTS_DOC_ID`, + ADD COLUMN `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" + ); + } else { + DBManager::get()->exec( + "ALTER TABLE `files_search_index` + ADD COLUMN `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" + ); + } + + } +} |
