From 0e0214a71da29a33e83de466245166ff4942fd27 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 15 Jun 2025 15:51:59 +0700 Subject: [PATCH] [ticket/17525] Avoid index name duplication (auth_role_id) phpbb_acl_groups and phpbb_acl_users have indexes with the same names (auth_role_id) which can cause issues on SQLite/Postgres PHPBB-17525 --- .../data/v400/rename_auth_role_id_index.php | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 phpBB/phpbb/db/migration/data/v400/rename_auth_role_id_index.php diff --git a/phpBB/phpbb/db/migration/data/v400/rename_auth_role_id_index.php b/phpBB/phpbb/db/migration/data/v400/rename_auth_role_id_index.php new file mode 100644 index 0000000000..2b716583be --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v400/rename_auth_role_id_index.php @@ -0,0 +1,58 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v400; + +use phpbb\db\migration\migration; + +class rename_auth_role_id_index extends migration +{ + public static function depends_on() + { + return [ + '\phpbb\db\migration\data\v400\dev', + ]; + } + + public function update_schema() + { + return [ + 'drop_keys' => [ + $this->table_prefix . 'acl_users' => [ + 'auth_role_id', + ], + ], + 'add_index' => [ + $this->table_prefix . 'acl_users' => [ + 'usr_auth_role_id' => ['auth_role_id'], + ], + ], + ]; + } + + public function revert_schema() + { + return [ + 'drop_keys' => [ + $this->table_prefix . 'acl_users' => [ + 'usr_auth_role_id', + ], + ], + 'add_index' => [ + $this->table_prefix . 'acl_users' => [ + 'auth_role_id' => ['auth_role_id'], + ], + ], + ]; + } +}