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:54 +0100 |
| commit | 455f40df3a063b41779e020c766eea1104db587b (patch) | |
| tree | 4f726d94eda9495cc5dae8a612e86054efbef0be | |
| parent | 343a471f165dfef235e056caec1955fd9ee423cb (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" + ); + } + + } +} |
