]> source.dussan.org Git - nextcloud-server.git/commitdiff
Limit missing primary key fail to new tables
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>
Tue, 15 Mar 2022 15:52:51 +0000 (16:52 +0100)
committerJoas Schilling <coding@schilljs.com>
Mon, 21 Mar 2022 11:14:19 +0000 (12:14 +0100)
This will work on CI so devs notice it when they install the app for testing,
and at the same time existing faulty tables don't break the upgrade to 24

Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/DB/MigrationService.php

index e7361cb4cab5ef3014c7ab50c1dc9e7ff5419605..0cf37cb995a33d601bc4fb4fcb9d33fbe855648d 100644 (file)
@@ -634,7 +634,7 @@ 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) {
+                       } elseif (!$primaryKey instanceof Index && !$sourceTable instanceof Table) {
                                throw new \InvalidArgumentException('Table "' . $table->getName() . '" has no primary key and therefor will not behave sane in clustered setups.');
                        }
                }