Skip to content

Commit

Permalink
Merge pull request #22643 from nextcloud/bugfix/noid/fix-installing-o…
Browse files Browse the repository at this point in the history
…n-oracle

Fix installing on Oracle
  • Loading branch information
MorrisJobke authored Sep 7, 2020
2 parents 0e6344f + 5023084 commit 34d2ae2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/Migrations/Version18000Date20190920085628.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
$table->addColumn('displayname', Types::STRING, [
'notnull' => true,
'length' => 255,
'default' => '',
// Will be overwritten in postSchemaChange, but Oracle can not save
// empty strings in notnull columns
'default' => 'name',
]);
}

Expand Down
5 changes: 5 additions & 0 deletions lib/private/DB/MigrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@ public function ensureOracleIdentifierLengthLimit(Schema $sourceSchema, Schema $
if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && \strlen($thing->getName()) > 30) {
throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
}

if ($thing->getNotnull() && $thing->getDefault() === ''
&& $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.');
}
}

foreach ($table->getIndexes() as $thing) {
Expand Down

0 comments on commit 34d2ae2

Please sign in to comment.