diff options
author | Joas Schilling <coding@schilljs.com> | 2022-03-10 10:24:05 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-03-10 10:24:05 +0100 |
commit | b35253a4c30a7d769559f5e23f04700b6883e05b (patch) | |
tree | 4be1c1d3de3fa989aff5a3315b1014fa0eac2e2f /lib | |
parent | 933826dd11caa8293bf8226880030a5598c39ca6 (diff) | |
download | nextcloud-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.php | 2 |
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.'); } } |