Merge pull request #25706 from nextcloud/bugfix/noid/when-it-kicks-in

When coding style kicks in
This commit is contained in:
Roeland Jago Douma 2021-02-18 11:30:06 +01:00 committed by GitHub
commit d79cc8ea6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -557,25 +557,25 @@ class MigrationService {
$sourceTable = $sourceSchema->getTable($table->getName()); $sourceTable = $sourceSchema->getTable($table->getName());
} catch (SchemaException $e) { } catch (SchemaException $e) {
if (\strlen($table->getName()) - $prefixLength > 27) { if (\strlen($table->getName()) - $prefixLength > 27) {
throw new \InvalidArgumentException('Table name "' . $table->getName() . '" is too long.'); throw new \InvalidArgumentException('Table name "' . $table->getName() . '" is too long.');
} }
$sourceTable = null; $sourceTable = null;
} }
foreach ($table->getColumns() as $thing) { foreach ($table->getColumns() as $thing) {
if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && \strlen($thing->getName()) > 30) { if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && \strlen($thing->getName()) > 30) {
throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.'); throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
} }
if ($thing->getNotnull() && $thing->getDefault() === '' if ($thing->getNotnull() && $thing->getDefault() === ''
&& $sourceTable instanceof Table && !$sourceTable->hasColumn($thing->getName())) { && $sourceTable instanceof Table && !$sourceTable->hasColumn($thing->getName())) {
throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is NotNull, but has empty string or null as default.'); throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is NotNull, but has empty string or null as default.');
} }
} }
foreach ($table->getIndexes() as $thing) { foreach ($table->getIndexes() as $thing) {
if ((!$sourceTable instanceof Table || !$sourceTable->hasIndex($thing->getName())) && \strlen($thing->getName()) > 30) { if ((!$sourceTable instanceof Table || !$sourceTable->hasIndex($thing->getName())) && \strlen($thing->getName()) > 30) {
throw new \InvalidArgumentException('Index name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.'); throw new \InvalidArgumentException('Index name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
} }
} }
@ -606,17 +606,17 @@ class MigrationService {
} }
if (!$isUsingDefaultName && \strlen($indexName) > 30) { if (!$isUsingDefaultName && \strlen($indexName) > 30) {
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.'); throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
} }
if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength >= 23) { if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength >= 23) {
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.'); throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
} }
} }
} }
foreach ($sequences as $sequence) { foreach ($sequences as $sequence) {
if (!$sourceSchema->hasSequence($sequence->getName()) && \strlen($sequence->getName()) > 30) { if (!$sourceSchema->hasSequence($sequence->getName()) && \strlen($sequence->getName()) > 30) {
throw new \InvalidArgumentException('Sequence name "' . $sequence->getName() . '" is too long.'); throw new \InvalidArgumentException('Sequence name "' . $sequence->getName() . '" is too long.');
} }
} }
} }