Merge pull request #60826 from nextcloud/backport/60765/stable34

[stable34] Background jobs improvements
This commit is contained in:
Benjamin Gaussorgues 2026-05-29 12:03:32 +02:00 committed by GitHub
commit 8c70e5968a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 8 additions and 4 deletions

View file

@ -38,6 +38,8 @@ class Version34000Date20260518163022 extends SimpleMigrationStep {
$table->addColumn('class_name', Types::STRING, ['notnull' => true, 'length' => 255]);
$table->setPrimaryKey(['class_id']);
$table->addUniqueConstraint(['class_name'], 'class_index');
// Makes sure there is no auto-increment in Oracle
$schema->dropAutoincrementColumn('job_classes_registry', 'class_id');
return $schema;
}

View file

@ -45,6 +45,8 @@ class Version34000Date20260521110333 extends SimpleMigrationStep {
$table->addColumn('ram_peak_usage', Types::INTEGER, ['notnull' => true, 'default' => 0]); // Should be MEDIUMINT
$table->setPrimaryKey(['run_id']);
$table->addIndex(['status'], 'status');
// Makes sure there is no auto-increment in Oracle
$schema->dropAutoincrementColumn('job_runs', 'run_id');
return $schema;
}

View file

@ -72,9 +72,9 @@ final readonly class JobRuns implements IJobRuns {
$row['run_id'],
$this->classesRegistry->getName($row['class_id']),
$snowflakeInfo->getServerId(),
$row['pid'],
(int)$row['pid'],
$snowflakeInfo->getCreatedAt(),
JobStatus::from($row['status']),
JobStatus::from((int)$row['status']),
);
}
}

View file

@ -144,7 +144,7 @@ class SchemaWrapper implements ISchemaWrapper {
#[\Override]
public function dropAutoincrementColumn(string $table, string $column): void {
$tableObj = $this->schema->getTable($this->connection->getPrefix() . $table);
$tableObj->modifyColumn('id', ['autoincrement' => false]);
$tableObj->modifyColumn($column, ['autoincrement' => false]);
$platform = $this->getDatabasePlatform();
if ($platform instanceof OraclePlatform) {
try {

View file

@ -25,7 +25,7 @@ final readonly class JobRun {
*/
public function __construct(
/** Run ID (Snowflake ID) */
public int $runId,
public int|string $runId,
/** Class name */
public string $className,
/** Server ID */