diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-03-15 10:53:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-15 10:53:11 +0100 |
commit | 04a4562a01e3594797ff4179769f3f9a45c3d9d2 (patch) | |
tree | db1d4dba8e4843ad63242f8e014a62b5184f10ad /lib | |
parent | 1ae6b2be71acecca486ce24f61a713ad6a669fc8 (diff) | |
parent | 1970d3dc9ab599e67ad1a0393fc5707ec283cf08 (diff) | |
download | nextcloud-server-04a4562a01e3594797ff4179769f3f9a45c3d9d2.tar.gz nextcloud-server-04a4562a01e3594797ff4179769f3f9a45c3d9d2.zip |
Merge pull request #31513 from nextcloud/techdebt/noid/enforce-primary-keys
Enforce primary keys as they are required to be performant in MySQL c…
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.'); } } |