@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | if ($appName === 'core') { |
80 | - $this->migrationsPath = \OC::$SERVERROOT . '/core/Migrations'; |
|
80 | + $this->migrationsPath = \OC::$SERVERROOT.'/core/Migrations'; |
|
81 | 81 | $this->migrationsNamespace = 'OC\\Core\\Migrations'; |
82 | 82 | $this->checkOracle = true; |
83 | 83 | } else { |
@@ -87,10 +87,10 @@ discard block |
||
87 | 87 | $appPath = $appLocator->getAppPath($appName); |
88 | 88 | $namespace = App::buildAppNamespace($appName); |
89 | 89 | $this->migrationsPath = "$appPath/lib/Migration"; |
90 | - $this->migrationsNamespace = $namespace . '\\Migration'; |
|
90 | + $this->migrationsNamespace = $namespace.'\\Migration'; |
|
91 | 91 | |
92 | 92 | $infoParser = new InfoParser(); |
93 | - $info = $infoParser->parse($appPath . '/appinfo/info.xml'); |
|
93 | + $info = $infoParser->parse($appPath.'/appinfo/info.xml'); |
|
94 | 94 | if (!isset($info['dependencies']['database'])) { |
95 | 95 | $this->checkOracle = true; |
96 | 96 | } else { |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | \RegexIterator::GET_MATCH); |
229 | 229 | |
230 | 230 | $files = array_keys(iterator_to_array($iterator)); |
231 | - uasort($files, function ($a, $b) { |
|
231 | + uasort($files, function($a, $b) { |
|
232 | 232 | preg_match('/^Version(\d+)Date(\d+)\\.php$/', basename($a), $matchA); |
233 | 233 | preg_match('/^Version(\d+)Date(\d+)\\.php$/', basename($b), $matchB); |
234 | 234 | if (!empty($matchA) && !empty($matchB)) { |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @return string |
307 | 307 | */ |
308 | 308 | public function getMigrationsTableName() { |
309 | - return $this->connection->getPrefix() . 'migrations'; |
|
309 | + return $this->connection->getPrefix().'migrations'; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } catch (\Exception $e) { |
427 | 427 | // The exception itself does not contain the name of the migration, |
428 | 428 | // so we wrap it here, to make debugging easier. |
429 | - throw new \Exception('Database error when running migration ' . $version . ' for app ' . $this->getApp() . PHP_EOL. $e->getMessage(), 0, $e); |
|
429 | + throw new \Exception('Database error when running migration '.$version.' for app '.$this->getApp().PHP_EOL.$e->getMessage(), 0, $e); |
|
430 | 430 | } |
431 | 431 | } |
432 | 432 | } |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | foreach ($toBeExecuted as $version) { |
450 | 450 | $instance = $this->createInstance($version); |
451 | 451 | |
452 | - $toSchema = $instance->changeSchema($this->output, function () use ($toSchema) { |
|
452 | + $toSchema = $instance->changeSchema($this->output, function() use ($toSchema) { |
|
453 | 453 | return $toSchema ?: new SchemaWrapper($this->connection); |
454 | 454 | }, ['tablePrefix' => $this->connection->getPrefix()]) ?: $toSchema; |
455 | 455 | } |
@@ -522,12 +522,12 @@ discard block |
||
522 | 522 | $instance = $this->createInstance($version); |
523 | 523 | |
524 | 524 | if (!$schemaOnly) { |
525 | - $instance->preSchemaChange($this->output, function () { |
|
525 | + $instance->preSchemaChange($this->output, function() { |
|
526 | 526 | return new SchemaWrapper($this->connection); |
527 | 527 | }, ['tablePrefix' => $this->connection->getPrefix()]); |
528 | 528 | } |
529 | 529 | |
530 | - $toSchema = $instance->changeSchema($this->output, function () { |
|
530 | + $toSchema = $instance->changeSchema($this->output, function() { |
|
531 | 531 | return new SchemaWrapper($this->connection); |
532 | 532 | }, ['tablePrefix' => $this->connection->getPrefix()]); |
533 | 533 | |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | } |
543 | 543 | |
544 | 544 | if (!$schemaOnly) { |
545 | - $instance->postSchemaChange($this->output, function () { |
|
545 | + $instance->postSchemaChange($this->output, function() { |
|
546 | 546 | return new SchemaWrapper($this->connection); |
547 | 547 | }, ['tablePrefix' => $this->connection->getPrefix()]); |
548 | 548 | } |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | $sourceTable = $sourceSchema->getTable($table->getName()); |
577 | 577 | } catch (SchemaException $e) { |
578 | 578 | if (\strlen($table->getName()) - $prefixLength > 27) { |
579 | - throw new \InvalidArgumentException('Table name "' . $table->getName() . '" is too long.'); |
|
579 | + throw new \InvalidArgumentException('Table name "'.$table->getName().'" is too long.'); |
|
580 | 580 | } |
581 | 581 | $sourceTable = null; |
582 | 582 | } |
@@ -585,16 +585,16 @@ discard block |
||
585 | 585 | // If the table doesn't exist OR if the column doesn't exist in the table |
586 | 586 | if (!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) { |
587 | 587 | if (\strlen($thing->getName()) > 30) { |
588 | - throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.'); |
|
588 | + throw new \InvalidArgumentException('Column name "'.$table->getName().'"."'.$thing->getName().'" is too long.'); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | if ($thing->getNotnull() && $thing->getDefault() === '' |
592 | 592 | && $sourceTable instanceof Table && !$sourceTable->hasColumn($thing->getName())) { |
593 | - throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is NotNull, but has empty string or null as default.'); |
|
593 | + throw new \InvalidArgumentException('Column "'.$table->getName().'"."'.$thing->getName().'" is NotNull, but has empty string or null as default.'); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | if ($thing->getNotnull() && $thing->getType()->getName() === Types::BOOLEAN) { |
597 | - throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type Bool and also NotNull, so it can not store "false".'); |
|
597 | + throw new \InvalidArgumentException('Column "'.$table->getName().'"."'.$thing->getName().'" is type Bool and also NotNull, so it can not store "false".'); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | $sourceColumn = null; |
@@ -606,19 +606,19 @@ discard block |
||
606 | 606 | // we will NOT detect invalid length if the column is not modified |
607 | 607 | if (($sourceColumn === null || $sourceColumn->getLength() !== $thing->getLength() || $sourceColumn->getType()->getName() !== Types::STRING) |
608 | 608 | && $thing->getLength() > 4000 && $thing->getType()->getName() === Types::STRING) { |
609 | - throw new \InvalidArgumentException('Column "' . $table->getName() . '"."' . $thing->getName() . '" is type String, but exceeding the 4.000 length limit.'); |
|
609 | + throw new \InvalidArgumentException('Column "'.$table->getName().'"."'.$thing->getName().'" is type String, but exceeding the 4.000 length limit.'); |
|
610 | 610 | } |
611 | 611 | } |
612 | 612 | |
613 | 613 | foreach ($table->getIndexes() as $thing) { |
614 | 614 | if ((!$sourceTable instanceof Table || !$sourceTable->hasIndex($thing->getName())) && \strlen($thing->getName()) > 30) { |
615 | - throw new \InvalidArgumentException('Index name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.'); |
|
615 | + throw new \InvalidArgumentException('Index name "'.$table->getName().'"."'.$thing->getName().'" is too long.'); |
|
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
619 | 619 | foreach ($table->getForeignKeys() as $thing) { |
620 | 620 | if ((!$sourceTable instanceof Table || !$sourceTable->hasForeignKey($thing->getName())) && \strlen($thing->getName()) > 30) { |
621 | - throw new \InvalidArgumentException('Foreign key name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.'); |
|
621 | + throw new \InvalidArgumentException('Foreign key name "'.$table->getName().'"."'.$thing->getName().'" is too long.'); |
|
622 | 622 | } |
623 | 623 | } |
624 | 624 | |
@@ -628,25 +628,25 @@ discard block |
||
628 | 628 | $isUsingDefaultName = $indexName === 'primary'; |
629 | 629 | |
630 | 630 | if ($this->connection->getDatabasePlatform() instanceof PostgreSQL94Platform) { |
631 | - $defaultName = $table->getName() . '_pkey'; |
|
631 | + $defaultName = $table->getName().'_pkey'; |
|
632 | 632 | $isUsingDefaultName = strtolower($defaultName) === $indexName; |
633 | 633 | |
634 | 634 | if ($isUsingDefaultName) { |
635 | - $sequenceName = $table->getName() . '_' . implode('_', $primaryKey->getColumns()) . '_seq'; |
|
636 | - $sequences = array_filter($sequences, function (Sequence $sequence) use ($sequenceName) { |
|
635 | + $sequenceName = $table->getName().'_'.implode('_', $primaryKey->getColumns()).'_seq'; |
|
636 | + $sequences = array_filter($sequences, function(Sequence $sequence) use ($sequenceName) { |
|
637 | 637 | return $sequence->getName() !== $sequenceName; |
638 | 638 | }); |
639 | 639 | } |
640 | 640 | } elseif ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { |
641 | - $defaultName = $table->getName() . '_seq'; |
|
641 | + $defaultName = $table->getName().'_seq'; |
|
642 | 642 | $isUsingDefaultName = strtolower($defaultName) === $indexName; |
643 | 643 | } |
644 | 644 | |
645 | 645 | if (!$isUsingDefaultName && \strlen($indexName) > 30) { |
646 | - throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.'); |
|
646 | + throw new \InvalidArgumentException('Primary index name on "'.$table->getName().'" is too long.'); |
|
647 | 647 | } |
648 | 648 | if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength >= 23) { |
649 | - throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.'); |
|
649 | + throw new \InvalidArgumentException('Primary index name on "'.$table->getName().'" is too long.'); |
|
650 | 650 | } |
651 | 651 | // } elseif (!$primaryKey instanceof Index && !$sourceTable instanceof Table) { |
652 | 652 | // throw new \InvalidArgumentException('Table "' . $table->getName() . '" has no primary key and therefor will not behave sane in clustered setups.'); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | foreach ($sequences as $sequence) { |
657 | 657 | if (!$sourceSchema->hasSequence($sequence->getName()) && \strlen($sequence->getName()) > 30) { |
658 | - throw new \InvalidArgumentException('Sequence name "' . $sequence->getName() . '" is too long.'); |
|
658 | + throw new \InvalidArgumentException('Sequence name "'.$sequence->getName().'" is too long.'); |
|
659 | 659 | } |
660 | 660 | } |
661 | 661 | } |