fix(db): ensure no autoincrement for Oracle

Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
This commit is contained in:
Benjamin Gaussorgues 2026-05-28 15:56:38 +02:00
parent 28d54ed26b
commit f881e95e18
No known key found for this signature in database
3 changed files with 5 additions and 1 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

@ -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 {