Skip to content

Commit c8baa91

Browse files
Altahrimbackportbot[bot]
authored andcommitted
fix(db): ensure no autoincrement for Oracle
fix(db): ensure no autoincrement for Oracle Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com> [skip ci]
1 parent 13ead49 commit c8baa91

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

core/Migrations/Version34000Date20260518163022.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3838
$table->addColumn('class_name', Types::STRING, ['notnull' => true, 'length' => 255]);
3939
$table->setPrimaryKey(['class_id']);
4040
$table->addUniqueConstraint(['class_name'], 'class_index');
41+
// Makes sure there is no auto-increment in Oracle
42+
$schema->dropAutoincrementColumn('job_classes_registry', 'class_id');
4143

4244
return $schema;
4345
}

core/Migrations/Version34000Date20260521110333.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
4545
$table->addColumn('ram_peak_usage', Types::INTEGER, ['notnull' => true, 'default' => 0]); // Should be MEDIUMINT
4646
$table->setPrimaryKey(['run_id']);
4747
$table->addIndex(['status'], 'status');
48+
// Makes sure there is no auto-increment in Oracle
49+
$schema->dropAutoincrementColumn('job_runs', 'run_id');
4850

4951
return $schema;
5052
}

lib/private/DB/SchemaWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function getDatabasePlatform() {
144144
#[\Override]
145145
public function dropAutoincrementColumn(string $table, string $column): void {
146146
$tableObj = $this->schema->getTable($this->connection->getPrefix() . $table);
147-
$tableObj->modifyColumn('id', ['autoincrement' => false]);
147+
$tableObj->modifyColumn($column, ['autoincrement' => false]);
148148
$platform = $this->getDatabasePlatform();
149149
if ($platform instanceof OraclePlatform) {
150150
try {

0 commit comments

Comments
 (0)