refactor(dbal): Port away from deprecated hasPrimaryKey

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
This commit is contained in:
Carl Schwan 2025-10-10 15:44:43 +02:00
parent c89ca89f2f
commit b0c6ef5821
2 changed files with 2 additions and 2 deletions

View file

@ -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('<info>Adding primary key to the ' . $missingKey['tableName'] . ' table, this can take some time...</info>');
$table->setPrimaryKey($missingKey['columns'], $missingKey['primaryKeyName']);

View file

@ -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';