Skip to content

Commit 6a6678c

Browse files
authored
Merge pull request #5394 from nextcloud/fix/db-doctrine-type
fix(migration): use doctrine string type
2 parents a164bda + 5af9a62 commit 6a6678c

2 files changed

Lines changed: 5 additions & 28 deletions

File tree

lib/Migration/Version10000Date20251217143558.php

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace OCA\Richdocuments\Migration;
1111

1212
use Closure;
13+
use Doctrine\DBAL\Types\Type;
1314
use OCP\DB\ISchemaWrapper;
1415
use OCP\Migration\IOutput;
1516
use OCP\Migration\SimpleMigrationStep;
@@ -19,22 +20,6 @@
1920
* Update version column in richdocuments_wopi table to support alphanumeric versions
2021
*/
2122
class Version10000Date20251217143558 extends SimpleMigrationStep {
22-
23-
/**
24-
* @param IOutput $output
25-
* @param Closure(): ISchemaWrapper $schemaClosure
26-
* @param array $options
27-
*/
28-
#[Override]
29-
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
30-
}
31-
32-
/**
33-
* @param IOutput $output
34-
* @param Closure(): ISchemaWrapper $schemaClosure
35-
* @param array $options
36-
* @return null|ISchemaWrapper
37-
*/
3823
#[Override]
3924
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
4025
/** @var ISchemaWrapper $schema */
@@ -45,33 +30,24 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4530
}
4631

4732
$table = $schema->getTable('richdocuments_wopi');
48-
33+
4934
if (!$table->hasColumn('version')) {
5035
return null;
5136
}
5237

5338
$column = $table->getColumn('version');
54-
39+
5540
if ($column->getType()->getName() === 'string') {
5641
return null;
5742
}
5843

5944
$table->changeColumn('version', [
60-
'type' => 'string',
45+
'type' => Type::getType('string'),
6146
'notnull' => false,
6247
'length' => 1024,
6348
'default' => '0',
6449
]);
6550

6651
return $schema;
6752
}
68-
69-
/**
70-
* @param IOutput $output
71-
* @param Closure(): ISchemaWrapper $schemaClosure
72-
* @param array $options
73-
*/
74-
#[Override]
75-
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
76-
}
7753
}

psalm.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<referencedClass name="OC\*" />
4242
<referencedClass name="OC" />
4343
<referencedClass name="OC\Security\CSP\ContentSecurityPolicyNonceManager" />
44+
<referencedClass name="Doctrine\DBAL\Types\Type" />
4445
</errorLevel>
4546
</UndefinedClass>
4647
<UndefinedDocblockClass>

0 commit comments

Comments
 (0)