From b0c6ef582113ae06a47a8a97d82761d324db22fa Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Fri, 10 Oct 2025 15:44:43 +0200 Subject: [PATCH] refactor(dbal): Port away from deprecated hasPrimaryKey Signed-off-by: Carl Schwan --- core/Command/Db/AddMissingPrimaryKeys.php | 2 +- lib/private/DB/MigrationService.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/Command/Db/AddMissingPrimaryKeys.php b/core/Command/Db/AddMissingPrimaryKeys.php index 1eb11c894fa..aed7084c946 100644 --- a/core/Command/Db/AddMissingPrimaryKeys.php +++ b/core/Command/Db/AddMissingPrimaryKeys.php @@ -55,7 +55,7 @@ class AddMissingPrimaryKeys extends Command { foreach ($missingKeys as $missingKey) { if ($schema->hasTable($missingKey['tableName'])) { $table = $schema->getTable($missingKey['tableName']); - if (!$table->hasPrimaryKey()) { + if ($table->getPrimaryKey() === null) { $output->writeln('Adding primary key to the ' . $missingKey['tableName'] . ' table, this can take some time...'); $table->setPrimaryKey($missingKey['columns'], $missingKey['primaryKeyName']); diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 51afd7c09c5..c7396ae4b84 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -610,7 +610,7 @@ class MigrationService { } $primaryKey = $table->getPrimaryKey(); - if ($primaryKey instanceof Index && (!$sourceTable instanceof Table || !$sourceTable->hasPrimaryKey())) { + if ($primaryKey instanceof Index && (!$sourceTable instanceof Table || $sourceTable->getPrimaryKey() === null)) { $indexName = strtolower($primaryKey->getName()); $isUsingDefaultName = $indexName === 'primary';