Skip to content

Commit

Permalink
fix(Db): Allow guest displaynames with a length of up to 255 chars
Browse files Browse the repository at this point in the history
useful in federated setup

Signed-off-by: Arthur Schiwon <[email protected]>
  • Loading branch information
blizzz committed Jan 30, 2025
1 parent f11bfb2 commit 419386c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Migration/Version2060Date20200302131958.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
]);
$table->addColumn('guest_displayname', 'string', [
'notnull' => false,
'length' => 64,
'length' => 255,
]);
$table->addColumn('fileid', 'bigint', [
'notnull' => true,
Expand Down
39 changes: 39 additions & 0 deletions lib/Migration/Version9000Date20250128212050.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Richdocuments\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version9000Date20250128212050 extends SimpleMigrationStep {

public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('richdocuments_wopi')) {
return null;
}

$table = $schema->getTable('richdocuments_wopi');
if (!$table->hasColumn('guest_displayname')) {
return null;
}

$column = $table->getColumn('guest_displayname');
if ($column->getLength() === 255) {
return null;
}

$column->setLength(255);
return $schema;
}
}

0 comments on commit 419386c

Please sign in to comment.