From 38ee655b2ae2cec9503151b0c08e03281d50d743 Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 5 Jul 2025 23:05:13 +0700 Subject: [PATCH] [ticket/17507] Add id as primary key, fix schema_create_primary_key() method PHPBB-17507 --- phpBB/phpbb/db/migration/data/v400/remove_jabber.php | 5 ++++- phpBB/phpbb/db/tools/doctrine.php | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/phpBB/phpbb/db/migration/data/v400/remove_jabber.php b/phpBB/phpbb/db/migration/data/v400/remove_jabber.php index 82b25b819f..17bf49d753 100644 --- a/phpBB/phpbb/db/migration/data/v400/remove_jabber.php +++ b/phpBB/phpbb/db/migration/data/v400/remove_jabber.php @@ -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'], + ], ]; } diff --git a/phpBB/phpbb/db/tools/doctrine.php b/phpBB/phpbb/db/tools/doctrine.php index 043252b4c5..2675c59e30 100644 --- a/phpBB/phpbb/db/tools/doctrine.php +++ b/phpBB/phpbb/db/tools/doctrine.php @@ -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);