]> source.dussan.org Git - nextcloud-server.git/commitdiff
Indeces, columns and sequences don't have the table prefix 14902/head
authorJoas Schilling <coding@schilljs.com>
Thu, 28 Mar 2019 13:51:11 +0000 (14:51 +0100)
committerJoas Schilling <coding@schilljs.com>
Thu, 28 Mar 2019 13:51:11 +0000 (14:51 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/DB/MigrationService.php

index 97f1dd269d130e51123cb5a5463f30c4760e0a22..d26337990d10b3ac80061e7a1faaddf129005bb5 100644 (file)
@@ -507,19 +507,19 @@ class MigrationService {
                        }
 
                        foreach ($table->getColumns() as $thing) {
-                               if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && \strlen($thing->getName()) - $prefixLength > 27) {
+                               if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && \strlen($thing->getName()) > 30) {
                                        throw new \InvalidArgumentException('Column name "'  . $table->getName() . '"."' . $thing->getName() . '" is too long.');
                                }
                        }
 
                        foreach ($table->getIndexes() as $thing) {
-                               if ((!$sourceTable instanceof Table || !$sourceTable->hasIndex($thing->getName())) && \strlen($thing->getName()) - $prefixLength > 27) {
+                               if ((!$sourceTable instanceof Table || !$sourceTable->hasIndex($thing->getName())) && \strlen($thing->getName()) > 30) {
                                        throw new \InvalidArgumentException('Index name "'  . $table->getName() . '"."' . $thing->getName() . '" is too long.');
                                }
                        }
 
                        foreach ($table->getForeignKeys() as $thing) {
-                               if ((!$sourceTable instanceof Table || !$sourceTable->hasForeignKey($thing->getName())) && \strlen($thing->getName()) - $prefixLength > 27) {
+                               if ((!$sourceTable instanceof Table || !$sourceTable->hasForeignKey($thing->getName())) && \strlen($thing->getName()) > 30) {
                                        throw new \InvalidArgumentException('Foreign key name "'  . $table->getName() . '"."' . $thing->getName() . '" is too long.');
                                }
                        }
@@ -544,17 +544,17 @@ class MigrationService {
                                        $isUsingDefaultName = strtolower($defaultName) === $indexName;
                                }
 
-                               if (!$isUsingDefaultName && \strlen($indexName) - $prefixLength > 27) {
+                               if (!$isUsingDefaultName && \strlen($indexName) > 30) {
                                        throw new \InvalidArgumentException('Primary index name  on "'  . $table->getName() . '" is too long.');
                                }
-                               if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength > 23) {
+                               if ($isUsingDefaultName && \strlen($table->getName()) > 26) {
                                        throw new \InvalidArgumentException('Primary index name  on "'  . $table->getName() . '" is too long.');
                                }
                        }
                }
 
                foreach ($sequences as $sequence) {
-                       if (!$sourceSchema->hasSequence($sequence->getName()) && \strlen($sequence->getName()) - $prefixLength > 27) {
+                       if (!$sourceSchema->hasSequence($sequence->getName()) && \strlen($sequence->getName()) > 30) {
                                throw new \InvalidArgumentException('Sequence name "'  . $sequence->getName() . '" is too long.');
                        }
                }