Limit missing primary key fail to new tables

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>
pull/31580/head
Joas Schilling 4 years ago committed by Joas Schilling
parent 84ae0703a3
commit 32ede5489e
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
  1. 2
      lib/private/DB/MigrationService.php

@ -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.');
}
}

Loading…
Cancel
Save