aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-03-10 10:24:05 +0100
committerJoas Schilling <coding@schilljs.com>2022-03-10 10:24:05 +0100
commitb35253a4c30a7d769559f5e23f04700b6883e05b (patch)
tree4be1c1d3de3fa989aff5a3315b1014fa0eac2e2f /lib
parent933826dd11caa8293bf8226880030a5598c39ca6 (diff)
downloadnextcloud-server-b35253a4c30a7d769559f5e23f04700b6883e05b.tar.gz
nextcloud-server-b35253a4c30a7d769559f5e23f04700b6883e05b.zip
Enforce primary keys as they are required to be performant in MySQL clusters
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/DB/MigrationService.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index 6ad74a58591..e7361cb4cab 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -634,6 +634,8 @@ class MigrationService {
if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength >= 23) {
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
}
+ } elseif (!$primaryKey instanceof Index) {
+ throw new \InvalidArgumentException('Table "' . $table->getName() . '" has no primary key and therefor will not behave sane in clustered setups.');
}
}