diff options
| author | David Colón <david@davidiq.com> | 2017-03-01 22:55:13 -0500 |
|---|---|---|
| committer | David Colón <david@davidiq.com> | 2017-03-01 23:09:56 -0500 |
| commit | 59ac4a71b6dc53f2edf8bb5c669b14df9ce5544a (patch) | |
| tree | 9fbf9fcb2b2ca6beb7e50f5b89b93dbfab67ec51 /phpBB/phpbb/db/migration | |
| parent | e5eb7025141238a3486a0395c42c55411dafb259 (diff) | |
| download | forums-59ac4a71b6dc53f2edf8bb5c669b14df9ce5544a.tar forums-59ac4a71b6dc53f2edf8bb5c669b14df9ce5544a.tar.gz forums-59ac4a71b6dc53f2edf8bb5c669b14df9ce5544a.tar.bz2 forums-59ac4a71b6dc53f2edf8bb5c669b14df9ce5544a.tar.xz forums-59ac4a71b6dc53f2edf8bb5c669b14df9ce5544a.zip | |
[ticket/14992] Check index name length in a more proper way
[ticket/14992] Add indexes to user_notifications table
Diffstat (limited to 'phpBB/phpbb/db/migration')
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p1.php (renamed from phpBB/phpbb/db/migration/data/v32x/user_notifications_table_indexes.php) | 6 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p2.php | 46 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p3.php | 46 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/user_notifications_table_remove_duplicates.php | 2 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/user_notifications_table_temp_index.php | 46 | ||||
| -rw-r--r-- | phpBB/phpbb/db/migration/data/v32x/user_notifications_table_unique_index.php | 7 |
6 files changed, 146 insertions, 7 deletions
diff --git a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_indexes.php b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p1.php index 86a3891b46..93ff31ec6c 100644 --- a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_indexes.php +++ b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p1.php @@ -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', ), ), ); diff --git a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p2.php b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p2.php new file mode 100644 index 0000000000..e492b4e1f8 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p2.php @@ -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', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p3.php b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p3.php new file mode 100644 index 0000000000..1636b3024a --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_index_p3.php @@ -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', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_remove_duplicates.php b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_remove_duplicates.php index f5f0305fda..50d0642056 100644 --- a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_remove_duplicates.php +++ b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_remove_duplicates.php @@ -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', ); } diff --git a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_temp_index.php b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_temp_index.php new file mode 100644 index 0000000000..eea44e168c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_temp_index.php @@ -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', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_unique_index.php b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_unique_index.php index 925197a02b..51cf90c8a0 100644 --- a/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_unique_index.php +++ b/phpBB/phpbb/db/migration/data/v32x/user_notifications_table_unique_index.php @@ -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'), ), |
