Skip to content

Commit f59ae44

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

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;
@@ -31,7 +32,13 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3132
'unsigned' => true,
3233
]);
3334
$table->addColumn('class_name', Types::STRING, ['notnull' => true, 'length' => 255]);
34-
$table->addColumn('class_hash', Types::INTEGER, ['notnull' => true, 'unsigned' => true]);
35+
$platform = $schema->getDatabasePlatform();
36+
if ($platform instanceof PostgreSQLPlatform) {
37+
// PostgreSQL doesn't support unsigned INT
38+
$table->addColumn('class_hash', Types::BIGINT, ['notnull' => true]);
39+
} else {
40+
$table->addColumn('class_hash', Types::INTEGER, ['notnull' => true, 'unsigned' => true]);
41+
}
3542
$table->setPrimaryKey(['class_id']);
3643
$table->addUniqueConstraint(['class_hash', 'class_name'], 'class_index');
3744
$changed = true;

0 commit comments

Comments
 (0)