diff options
author | Joas Schilling <coding@schilljs.com> | 2018-07-20 12:31:52 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2018-07-27 14:45:21 +0200 |
commit | 5e0bfe5c16b1b53d64efcbcc38b22f84d8664959 (patch) | |
tree | a6c6ef24d93e6a5281e30fb2cc42bd07c0df91e2 /lib/private/DB | |
parent | 960961148ed2bea4818ca1abf8484ef3bf238f64 (diff) | |
download | nextcloud-server-5e0bfe5c16b1b53d64efcbcc38b22f84d8664959.tar.gz nextcloud-server-5e0bfe5c16b1b53d64efcbcc38b22f84d8664959.zip |
Ignore automatic generated sequences
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/DB')
-rw-r--r-- | lib/private/DB/MigrationService.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 99b8575cd97..2079a33e176 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -29,6 +29,7 @@ use Doctrine\DBAL\Schema\Column; use Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Schema; use Doctrine\DBAL\Schema\SchemaException; +use Doctrine\DBAL\Schema\Sequence; use OC\IntegrityCheck\Helpers\AppLocator; use OC\Migration\SimpleOutput; use OCP\AppFramework\App; @@ -471,6 +472,8 @@ class MigrationService { } public function ensureOracleIdentifierLengthLimit(Schema $schema) { + $sequences = $schema->getSequences(); + foreach ($schema->getTables() as $table) { if (\strlen($table->getName()) > 30) { throw new \InvalidArgumentException('Table name "' . $table->getName() . '" is too long.'); @@ -502,6 +505,12 @@ class MigrationService { if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { $defaultName = $table->getName() . '_' . implode('_', $primaryKey->getColumns()) . '_seq'; $isUsingDefaultName = strtolower($defaultName) === $indexName; + + if ($isUsingDefaultName) { + $sequences = array_filter($sequences, function(Sequence $sequence) use ($indexName) { + return $sequence->getName() !== $indexName; + }); + } } else if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { $defaultName = $table->getName() . '_seq'; $isUsingDefaultName = strtolower($defaultName) === $indexName; @@ -516,7 +525,7 @@ class MigrationService { } } - foreach ($schema->getSequences() as $sequence) { + foreach ($sequences as $sequence) { if (\strlen($sequence->getName()) > 30) { throw new \InvalidArgumentException('Sequence name "' . $sequence->getName() . '" is too long.'); } |