mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Merge pull request #4121 from marc1706/ticket/11875
[ticket/11875] Use 4-byte integer instead of 3-byte integer for ID columns * marc1706/ticket/11875: [ticket/11875] Add back new line [ticket/11875] Change more columns to use UINT and add missings ones [ticket/11875] Add migration file [ticket/11875] Recreate schemas for install [ticket/11875] Create new map for UNSIGNED 4-byte integer [ticket/11875] Upgrade default data type from MEDIUMINT to INT
This commit is contained in:
commit
39c9baa574
4 changed files with 371 additions and 5 deletions
358
phpBB/phpbb/db/migration/data/v320/default_data_type_ids.php
Normal file
358
phpBB/phpbb/db/migration/data/v320/default_data_type_ids.php
Normal file
|
@ -0,0 +1,358 @@
|
|||
<?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\v320;
|
||||
|
||||
class default_data_type_ids extends \phpbb\db\migration\migration
|
||||
{
|
||||
static public function depends_on()
|
||||
{
|
||||
return array('\phpbb\db\migration\data\v320\v320a2');
|
||||
}
|
||||
|
||||
public function update_schema()
|
||||
{
|
||||
return array(
|
||||
'change_columns' => array(
|
||||
$this->table_prefix . 'acl_users' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'attachments' => array(
|
||||
'attach_id' => array('ULINT', null, 'auto_increment'),
|
||||
'post_msg_id' => array('ULINT', 0),
|
||||
'poster_id' => array('ULINT', 0),
|
||||
'topic_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'banlist' => array(
|
||||
'ban_id' => array('ULINT', null, 'auto_increment'),
|
||||
'ban_userid' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'bookmarks' => array(
|
||||
'topic_id' => array('ULINT', 0),
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'bots' => array(
|
||||
'bot_id' => array('ULINT', null, 'auto_increment'),
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'drafts' => array(
|
||||
'draft_id' => array('ULINT', null, 'auto_increment'),
|
||||
'user_id' => array('ULINT', 0),
|
||||
'topic_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'forums' => array(
|
||||
'forum_last_post_id' => array('ULINT', 0),
|
||||
'forum_last_poster_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'forums_access' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'forums_track' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'forums_watch' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'log' => array(
|
||||
'log_id' => array('ULINT', null, 'auto_increment'),
|
||||
'post_id' => array('ULINT', 0),
|
||||
'reportee_id' => array('ULINT', 0),
|
||||
'user_id' => array('ULINT', 0),
|
||||
'topic_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'login_attempts' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'moderator_cache' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'notifications' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'oauth_accounts' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'oauth_states' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'oauth_tokens' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'poll_options' => array(
|
||||
'topic_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'poll_votes' => array(
|
||||
'topic_id' => array('ULINT', 0),
|
||||
'vote_user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'posts' => array(
|
||||
'post_id' => array('ULINT', null, 'auto_increment'),
|
||||
'poster_id' => array('ULINT', 0),
|
||||
'post_delete_user' => array('ULINT', 0),
|
||||
'post_edit_user' => array('ULINT', 0),
|
||||
'topic_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'privmsgs' => array(
|
||||
'author_id' => array('ULINT', 0),
|
||||
'message_edit_user' => array('ULINT', 0),
|
||||
'msg_id' => array('ULINT', null, 'auto_increment'),
|
||||
),
|
||||
$this->table_prefix . 'privmsgs_folder' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'privmsgs_rules' => array(
|
||||
'rule_user_id' => array('ULINT', 0),
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'privmsgs_to' => array(
|
||||
'author_id' => array('ULINT', 0),
|
||||
'msg_id' => array('ULINT', 0),
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'profile_fields_data' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'reports' => array(
|
||||
'report_id' => array('ULINT', 0),
|
||||
'pm_id' => array('ULINT', 0),
|
||||
'post_id' => array('ULINT', 0),
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'search_wordlist' => array(
|
||||
'word_id' => array('ULINT', null, 'auto_increment'),
|
||||
),
|
||||
$this->table_prefix . 'search_wordmatch' => array(
|
||||
'post_id' => array('ULINT', 0),
|
||||
'word_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'sessions' => array(
|
||||
'session_user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'sessions_keys' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'topics' => array(
|
||||
'topic_id' => array('ULINT', null, 'auto_increment'),
|
||||
'topic_poster' => array('ULINT', 0),
|
||||
'topic_first_post_id' => array('ULINT', 0),
|
||||
'topic_last_post_id' => array('ULINT', 0),
|
||||
'topic_last_poster_id' => array('ULINT', 0),
|
||||
'topic_moved_id' => array('ULINT', 0),
|
||||
'topic_delete_user' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'topics_track' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
'topic_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'topics_posted' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
'topic_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'topics_watch' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
'topic_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'user_notifications' => array(
|
||||
'item_id' => array('ULINT', 0),
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'user_group' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_id' => array('ULINT', null, 'auto_increment'),
|
||||
),
|
||||
$this->table_prefix . 'warnings' => array(
|
||||
'log_id' => array('ULINT', 0),
|
||||
'user_id' => array('ULINT', 0),
|
||||
'post_id' => array('ULINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'words' => array(
|
||||
'word_id' => array('ULINT', null, 'auto_increment'),
|
||||
),
|
||||
$this->table_prefix . 'zebra' => array(
|
||||
'user_id' => array('ULINT', 0),
|
||||
'zebra_id' => array('ULINT', 0),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function revert_schema()
|
||||
{
|
||||
return array(
|
||||
'change_columns' => array(
|
||||
$this->table_prefix . 'acl_users' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'attachments' => array(
|
||||
'attach_id' => array('UINT', null, 'auto_increment'),
|
||||
'post_msg_id' => array('UINT', 0),
|
||||
'poster_id' => array('UINT', 0),
|
||||
'topic_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'banlist' => array(
|
||||
'ban_id' => array('UINT', null, 'auto_increment'),
|
||||
'ban_userid' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'bookmarks' => array(
|
||||
'topic_id' => array('UINT', 0),
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'bots' => array(
|
||||
'bot_id' => array('UINT', null, 'auto_increment'),
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'drafts' => array(
|
||||
'draft_id' => array('UINT', null, 'auto_increment'),
|
||||
'user_id' => array('UINT', 0),
|
||||
'topic_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'forums' => array(
|
||||
'forum_last_post_id' => array('UINT', 0),
|
||||
'forum_last_poster_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'forums_access' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'forums_track' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'forums_watch' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'log' => array(
|
||||
'log_id' => array('UINT', null, 'auto_increment'),
|
||||
'post_id' => array('UINT', 0),
|
||||
'reportee_id' => array('UINT', 0),
|
||||
'user_id' => array('UINT', 0),
|
||||
'topic_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'login_attempts' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'moderator_cache' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'notifications' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'oauth_accounts' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'oauth_states' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'oauth_tokens' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'poll_options' => array(
|
||||
'topic_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'poll_votes' => array(
|
||||
'topic_id' => array('UINT', 0),
|
||||
'vote_user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'posts' => array(
|
||||
'post_id' => array('UINT', null, 'auto_increment'),
|
||||
'poster_id' => array('UINT', 0),
|
||||
'post_delete_user' => array('UINT', 0),
|
||||
'post_edit_user' => array('UINT', 0),
|
||||
'topic_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'privmsgs' => array(
|
||||
'author_id' => array('UINT', 0),
|
||||
'message_edit_user' => array('UINT', 0),
|
||||
'msg_id' => array('UINT', null, 'auto_increment'),
|
||||
),
|
||||
$this->table_prefix . 'privmsgs_folder' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'privmsgs_rules' => array(
|
||||
'rule_user_id' => array('UINT', 0),
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'privmsgs_to' => array(
|
||||
'author_id' => array('UINT', 0),
|
||||
'msg_id' => array('UINT', 0),
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'profile_fields_data' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'reports' => array(
|
||||
'report_id' => array('UINT', 0),
|
||||
'pm_id' => array('UINT', 0),
|
||||
'post_id' => array('UINT', 0),
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'search_wordlist' => array(
|
||||
'word_id' => array('UINT', null, 'auto_increment'),
|
||||
),
|
||||
$this->table_prefix . 'search_wordmatch' => array(
|
||||
'post_id' => array('UINT', 0),
|
||||
'word_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'sessions' => array(
|
||||
'session_user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'sessions_keys' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'topics' => array(
|
||||
'topic_id' => array('UINT', null, 'auto_increment'),
|
||||
'topic_poster' => array('UINT', 0),
|
||||
'topic_first_post_id' => array('UINT', 0),
|
||||
'topic_last_post_id' => array('UINT', 0),
|
||||
'topic_last_poster_id' => array('UINT', 0),
|
||||
'topic_moved_id' => array('UINT', 0),
|
||||
'topic_delete_user' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'topics_track' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
'topic_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'topics_posted' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
'topic_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'topics_watch' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
'topic_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'user_notifications' => array(
|
||||
'item_id' => array('UINT', 0),
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'user_group' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'users' => array(
|
||||
'user_id' => array('UINT', null, 'auto_increment'),
|
||||
),
|
||||
$this->table_prefix . 'warnings' => array(
|
||||
'log_id' => array('UINT', 0),
|
||||
'user_id' => array('UINT', 0),
|
||||
'post_id' => array('UINT', 0),
|
||||
),
|
||||
$this->table_prefix . 'words' => array(
|
||||
'word_id' => array('UINT', null, 'auto_increment'),
|
||||
),
|
||||
$this->table_prefix . 'zebra' => array(
|
||||
'user_id' => array('UINT', 0),
|
||||
'zebra_id' => array('UINT', 0),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -36,6 +36,7 @@ class mssql extends tools
|
|||
'mssql' => array(
|
||||
'INT:' => '[int]',
|
||||
'BINT' => '[float]',
|
||||
'ULINT' => '[int]',
|
||||
'UINT' => '[int]',
|
||||
'UINT:' => '[int]',
|
||||
'TINT:' => '[int]',
|
||||
|
@ -66,6 +67,7 @@ class mssql extends tools
|
|||
'mssqlnative' => array(
|
||||
'INT:' => '[int]',
|
||||
'BINT' => '[float]',
|
||||
'ULINT' => '[int]',
|
||||
'UINT' => '[int]',
|
||||
'UINT:' => '[int]',
|
||||
'TINT:' => '[int]',
|
||||
|
|
|
@ -30,6 +30,7 @@ class postgres extends tools
|
|||
'postgres' => array(
|
||||
'INT:' => 'INT4',
|
||||
'BINT' => 'INT8',
|
||||
'ULINT' => 'INT4', // unsigned
|
||||
'UINT' => 'INT4', // unsigned
|
||||
'UINT:' => 'INT4', // unsigned
|
||||
'USINT' => 'INT2', // unsigned
|
||||
|
|
|
@ -46,6 +46,7 @@ class tools implements tools_interface
|
|||
'mysql_41' => array(
|
||||
'INT:' => 'int(%d)',
|
||||
'BINT' => 'bigint(20)',
|
||||
'ULINT' => 'INT(10) UNSIGNED',
|
||||
'UINT' => 'mediumint(8) UNSIGNED',
|
||||
'UINT:' => 'int(%d) UNSIGNED',
|
||||
'TINT:' => 'tinyint(%d)',
|
||||
|
@ -76,6 +77,7 @@ class tools implements tools_interface
|
|||
'mysql_40' => array(
|
||||
'INT:' => 'int(%d)',
|
||||
'BINT' => 'bigint(20)',
|
||||
'ULINT' => 'INT(10) UNSIGNED',
|
||||
'UINT' => 'mediumint(8) UNSIGNED',
|
||||
'UINT:' => 'int(%d) UNSIGNED',
|
||||
'TINT:' => 'tinyint(%d)',
|
||||
|
@ -106,6 +108,7 @@ class tools implements tools_interface
|
|||
'oracle' => array(
|
||||
'INT:' => 'number(%d)',
|
||||
'BINT' => 'number(20)',
|
||||
'ULINT' => 'number(10)',
|
||||
'UINT' => 'number(8)',
|
||||
'UINT:' => 'number(%d)',
|
||||
'TINT:' => 'number(%d)',
|
||||
|
@ -136,6 +139,7 @@ class tools implements tools_interface
|
|||
'sqlite' => array(
|
||||
'INT:' => 'int(%d)',
|
||||
'BINT' => 'bigint(20)',
|
||||
'ULINT' => 'INTEGER UNSIGNED', // 'int(10) UNSIGNED',
|
||||
'UINT' => 'INTEGER UNSIGNED', // 'mediumint(8) UNSIGNED',
|
||||
'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED',
|
||||
'TINT:' => 'tinyint(%d)',
|
||||
|
@ -166,6 +170,7 @@ class tools implements tools_interface
|
|||
'sqlite3' => array(
|
||||
'INT:' => 'INT(%d)',
|
||||
'BINT' => 'BIGINT(20)',
|
||||
'ULINT' => 'INTEGER UNSIGNED',
|
||||
'UINT' => 'INTEGER UNSIGNED',
|
||||
'UINT:' => 'INTEGER UNSIGNED',
|
||||
'TINT:' => 'TINYINT(%d)',
|
||||
|
@ -199,7 +204,7 @@ class tools implements tools_interface
|
|||
* A list of types being unsigned for better reference in some db's
|
||||
* @var array
|
||||
*/
|
||||
var $unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP');
|
||||
var $unsigned_types = array('ULINT', 'UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP');
|
||||
|
||||
/**
|
||||
* This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array).
|
||||
|
|
Loading…
Add table
Reference in a new issue