1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-26 09:44:26 +02:00

[ticket/14992] Check index name length in a more proper way

[ticket/14992] Add indexes to user_notifications table
This commit is contained in:
David Colón
2017-03-01 22:55:13 -05:00
parent e5eb702514
commit 59ac4a71b6
7 changed files with 181 additions and 17 deletions

View File

@@ -13,7 +13,7 @@
namespace phpbb\db\migration\data\v32x;
class user_notifications_table_indexes extends \phpbb\db\migration\migration
class user_notifications_table_index_p1 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
@@ -28,8 +28,6 @@ class user_notifications_table_indexes extends \phpbb\db\migration\migration
'add_index' => array(
$this->table_prefix . 'user_notifications' => array(
'user_id' => array('user_id'),
'user_id_item_id' => array('user_id', 'item_id'),
'user_itm_type_id' => array('user_id', 'item_type', 'item_id'),
),
),
);
@@ -41,8 +39,6 @@ class user_notifications_table_indexes extends \phpbb\db\migration\migration
'drop_keys' => array(
$this->table_prefix . 'user_notifications' => array(
'user_id',
'user_id_item_id',
'user_itm_type_id',
),
),
);

View File

@@ -0,0 +1,46 @@
<?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\v32x;
class user_notifications_table_index_p2 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\user_notifications_table_index_p1',
);
}
public function update_schema()
{
return array(
'add_index' => array(
$this->table_prefix . 'user_notifications' => array(
'usr_id_itm_id' => array('user_id', 'item_id'),
),
),
);
}
public function revert_schema()
{
return array(
'drop_keys' => array(
$this->table_prefix . 'user_notifications' => array(
'usr_id_itm_id',
),
),
);
}
}

View File

@@ -0,0 +1,46 @@
<?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\v32x;
class user_notifications_table_index_p3 extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\user_notifications_table_index_p2',
);
}
public function update_schema()
{
return array(
'add_index' => array(
$this->table_prefix . 'user_notifications' => array(
'usr_itm_tpe' => array('user_id', 'item_type', 'item_id'),
),
),
);
}
public function revert_schema()
{
return array(
'drop_keys' => array(
$this->table_prefix . 'user_notifications' => array(
'usr_itm_tpe',
),
),
);
}
}

View File

@@ -18,7 +18,7 @@ class user_notifications_table_remove_duplicates extends \phpbb\db\migration\mig
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\user_notifications_table_indexes',
'\phpbb\db\migration\data\v32x\user_notifications_table_temp_index',
);
}

View File

@@ -0,0 +1,46 @@
<?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\v32x;
class user_notifications_table_temp_index extends \phpbb\db\migration\migration
{
static public function depends_on()
{
return array(
'\phpbb\db\migration\data\v32x\user_notifications_table_index_p3',
);
}
public function update_schema()
{
return array(
'add_index' => array(
$this->table_prefix . 'user_notifications' => array(
'itm_usr_mthd' => array('item_type', 'item_id', 'user_id', 'method'),
),
),
);
}
public function revert_schema()
{
return array(
'drop_keys' => array(
$this->table_prefix . 'user_notifications' => array(
'itm_usr_mthd',
),
),
);
}
}

View File

@@ -25,7 +25,12 @@ class user_notifications_table_unique_index extends \phpbb\db\migration\migratio
public function update_schema()
{
return array(
'add_unique_index' => array(
'drop_keys' => array(
$this->table_prefix . 'user_notifications' => array(
'itm_usr_mthd',
),
),
'add_unique_index' => array(
$this->table_prefix . 'user_notifications' => array(
'itm_usr_mthd' => array('item_type', 'item_id', 'user_id', 'method'),
),