summaryrefslogtreecommitdiffstats
path: root/lib/private/DB
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2018-07-27 14:30:29 +0200
committerJoas Schilling <coding@schilljs.com>2018-07-27 14:45:22 +0200
commit008c8dde1aac6b0351f8145e20a4c8a93bf77372 (patch)
tree22c2017cfcd7950e7c65a5f18c2edbe71af9e779 /lib/private/DB
parent5e0bfe5c16b1b53d64efcbcc38b22f84d8664959 (diff)
downloadnextcloud-server-008c8dde1aac6b0351f8145e20a4c8a93bf77372.tar.gz
nextcloud-server-008c8dde1aac6b0351f8145e20a4c8a93bf77372.zip
Ignore custom prefixes which are longer
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/DB')
-rw-r--r--lib/private/DB/MigrationService.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php
index 2079a33e176..94b2b55e16f 100644
--- a/lib/private/DB/MigrationService.php
+++ b/lib/private/DB/MigrationService.php
@@ -457,7 +457,7 @@ class MigrationService {
if ($toSchema instanceof SchemaWrapper) {
$targetSchema = $toSchema->getWrappedSchema();
- $this->ensureOracleIdentifierLengthLimit($targetSchema);
+ $this->ensureOracleIdentifierLengthLimit($targetSchema, strlen($this->connection->getPrefix()));
$this->connection->migrateToSchema($targetSchema);
$toSchema->performDropTableCalls();
}
@@ -471,28 +471,28 @@ class MigrationService {
$this->markAsExecuted($version);
}
- public function ensureOracleIdentifierLengthLimit(Schema $schema) {
+ public function ensureOracleIdentifierLengthLimit(Schema $schema, int $prefixLength) {
$sequences = $schema->getSequences();
foreach ($schema->getTables() as $table) {
- if (\strlen($table->getName()) > 30) {
+ if (\strlen($table->getName()) - $prefixLength > 27) {
throw new \InvalidArgumentException('Table name "' . $table->getName() . '" is too long.');
}
foreach ($table->getColumns() as $thing) {
- if (\strlen($thing->getName()) > 30) {
+ if (\strlen($thing->getName()) - $prefixLength > 27) {
throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
}
}
foreach ($table->getIndexes() as $thing) {
- if (\strlen($thing->getName()) > 30) {
+ if (\strlen($thing->getName()) - $prefixLength > 27) {
throw new \InvalidArgumentException('Index name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
}
}
foreach ($table->getForeignKeys() as $thing) {
- if (\strlen($thing->getName()) > 30) {
+ if (\strlen($thing->getName()) - $prefixLength > 27) {
throw new \InvalidArgumentException('Foreign key name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
}
}
@@ -516,17 +516,17 @@ class MigrationService {
$isUsingDefaultName = strtolower($defaultName) === $indexName;
}
- if (!$isUsingDefaultName && \strlen($indexName) > 30) {
+ if (!$isUsingDefaultName && \strlen($indexName) - $prefixLength > 27) {
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
}
- if ($isUsingDefaultName && \strlen($table->getName()) > 26) {
+ if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength > 23) {
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
}
}
}
foreach ($sequences as $sequence) {
- if (\strlen($sequence->getName()) > 30) {
+ if (\strlen($sequence->getName()) - $prefixLength > 27) {
throw new \InvalidArgumentException('Sequence name "' . $sequence->getName() . '" is too long.');
}
}