aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2026-03-10 12:29:54 +0100
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2026-03-10 12:29:54 +0100
commit4627ad6b806eaa49832784c52a33ba93001437df (patch)
tree1b5bba6a9149466c0de585415d9f37a6409cdecd
parent08da9f257ff4efc98dd058e81984ac9bd6e46639 (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.php30
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"
+ );
+ }
+
+ }
+}