[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
This commit is contained in:
rxu 2025-06-15 15:51:59 +07:00
parent 8d1f8af7c6
commit 0e0214a71d
No known key found for this signature in database
GPG key ID: 955F0567380E586A

View file

@ -0,0 +1,58 @@
<?php
/**
*
* This file is part of the phpBB Forum Software package.
*
* @copyright (c) phpBB Limited <https://www.phpbb.com>
* @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'],
],
],
];
}
}