[ticket/17507] Add id as primary key, fix schema_create_primary_key() method

PHPBB-17507
This commit is contained in:
rxu 2025-07-05 23:05:13 +07:00
parent e4cd3ac744
commit 38ee655b2a
No known key found for this signature in database
GPG key ID: 955F0567380E586A
2 changed files with 7 additions and 3 deletions

View file

@ -39,7 +39,10 @@ class remove_jabber extends migration
$this->table_prefix . 'user_notifications' => [
'id' => ['ULINT', null, 'auto_increment'],
],
]
],
'add_primary_keys' => [
$this->table_prefix . 'user_notifications' => ['id'],
],
];
}

View file

@ -993,13 +993,14 @@ class doctrine implements tools_interface
* @param $column
* @param Schema $schema
* @param string $table_name
* @param array|string $column_name
* @param bool $safe_check
*
* @throws SchemaException
*/
protected function schema_create_primary_key(Schema $schema, $column, string $table_name, bool $safe_check = false): void
protected function schema_create_primary_key(Schema $schema, string $table_name, array|string $column_name, bool $safe_check = false): void
{
$columns = (is_array($column)) ? $column : [$column];
$columns = (is_array($column_name)) ? $column_name : [$column_name];
$table = $schema->getTable($table_name);
$table->dropPrimaryKey();
$table->setPrimaryKey($columns);