From b35253a4c30a7d769559f5e23f04700b6883e05b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 10 Mar 2022 10:24:05 +0100 Subject: Enforce primary keys as they are required to be performant in MySQL clusters Signed-off-by: Joas Schilling --- lib/private/DB/MigrationService.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib') 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.'); } } -- cgit v1.2.3