Skip to content

Commit c97df0f

Browse files
authored
Merge pull request #22653 from nextcloud/backport/22643/stable18
[stable18] Fix installing on Oracle
2 parents f1a7854 + 54a5f93 commit c97df0f

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
@@ -59,7 +59,9 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
5959
$table->addColumn('displayname', Type::STRING, [
6060
'notnull' => true,
6161
'length' => 255,
62-
'default' => '',
62+
// Will be overwritten in postSchemaChange, but Oracle can not save
63+
// empty strings in notnull columns
64+
'default' => 'name',
6365
]);
6466
}
6567

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)