refactor(dbal): Port away from deprecated hasPrimaryKey

Signed-off-by: Carl Schwan <carl.schwan@nextcloud.com>
pull/55674/head
Carl Schwan 3 months ago
parent c89ca89f2f
commit b0c6ef5821
  1. 2
      core/Command/Db/AddMissingPrimaryKeys.php
  2. 2
      lib/private/DB/MigrationService.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('<info>Adding primary key to the ' . $missingKey['tableName'] . ' table, this can take some time...</info>');
$table->setPrimaryKey($missingKey['columns'], $missingKey['primaryKeyName']);

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

Loading…
Cancel
Save