Skip to content

Commit 34d2ae2

Browse files
authored
Merge pull request #22643 from nextcloud/bugfix/noid/fix-installing-on-oracle
Fix installing on Oracle
2 parents 0e6344f + 5023084 commit 34d2ae2

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

core/Migrations/Version18000Date20190920085628.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
6060
$table->addColumn('displayname', Types::STRING, [
6161
'notnull' => true,
6262
'length' => 255,
63-
'default' => '',
63+
// Will be overwritten in postSchemaChange, but Oracle can not save
64+
// empty strings in notnull columns
65+
'default' => 'name',
6466
]);
6567
}
6668

lib/private/DB/MigrationService.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,11 @@ public function ensureOracleIdentifierLengthLimit(Schema $sourceSchema, Schema $
513513
if ((!$sourceTable instanceof Table || !$sourceTable->hasColumn($thing->getName())) && \strlen($thing->getName()) > 30) {
514514
throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is too long.');
515515
}
516+
517+
if ($thing->getNotnull() && $thing->getDefault() === ''
518+
&& $sourceTable instanceof Table && !$sourceTable->hasColumn($thing->getName())) {
519+
throw new \InvalidArgumentException('Column name "' . $table->getName() . '"."' . $thing->getName() . '" is NotNull, but has empty string or null as default.');
520+
}
516521
}
517522

518523
foreach ($table->getIndexes() as $thing) {

0 commit comments

Comments
 (0)