Skip to content

Commit c5794ef

Browse files
committed
fix(jobs): Postfix needs larger BIGINT to store unsigned INT
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
1 parent caf08a4 commit c5794ef

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

core/Migrations/Version34000Date20260518163022.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
namespace OC\Core\Migrations;
1111

1212
use Closure;
13+
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
1314
use OCP\DB\ISchemaWrapper;
1415
use OCP\DB\Types;
1516
use OCP\Migration\IOutput;
@@ -30,7 +31,13 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3031
'unsigned' => true,
3132
]);
3233
$table->addColumn('class_name', Types::STRING, ['notnull' => true, 'length' => 255]);
33-
$table->addColumn('class_hash', Types::INTEGER, ['notnull' => true, 'unsigned' => true]);
34+
$platform = $schema->getDatabasePlatform();
35+
if ($platform instanceof PostgreSQLPlatform) {
36+
// PostgreSQL doesn't support unsigned INT
37+
$table->addColumn('class_hash', Types::BIGINT, ['notnull' => true]);
38+
} else {
39+
$table->addColumn('class_hash', Types::INTEGER, ['notnull' => true, 'unsigned' => true]);
40+
}
3441
$table->setPrimaryKey(['class_id']);
3542
$table->addUniqueConstraint(['class_hash', 'class_name'], 'class_index');
3643

0 commit comments

Comments
 (0)