Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
961cc62c
Commit
961cc62c
authored
Dec 11, 2007
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 153129: Bugzilla uses "mediumtext" as a DB data type when it's not necessary
Patch By Xiaoou Wu <xiaoou.wu@oracle.com> and Max Kanat-Alexander <mkanat@bugzilla.org> r=mkanat, a=mkanat
parent
eb08f76a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
21 deletions
+86
-21
Schema.pm
Bugzilla/DB/Schema.pm
+15
-17
Mysql.pm
Bugzilla/DB/Schema/Mysql.pm
+2
-1
Pg.pm
Bugzilla/DB/Schema/Pg.pm
+1
-1
DB.pm
Bugzilla/Install/DB.pm
+61
-2
strings.txt.pl
template/en/default/setup/strings.txt.pl
+7
-0
No files found.
Bugzilla/DB/Schema.pm
View file @
961cc62c
...
...
@@ -218,7 +218,7 @@ use constant ABSTRACT_SCHEMA => {
bug_id
=>
{
TYPE
=>
'MEDIUMSERIAL'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
},
assigned_to
=>
{
TYPE
=>
'INT3'
,
NOTNULL
=>
1
},
bug_file_loc
=>
{
TYPE
=>
'TEXT'
},
bug_file_loc
=>
{
TYPE
=>
'
MEDIUM
TEXT'
},
bug_severity
=>
{
TYPE
=>
'varchar(64)'
,
NOTNULL
=>
1
},
bug_status
=>
{
TYPE
=>
'varchar(64)'
,
NOTNULL
=>
1
},
creation_ts
=>
{
TYPE
=>
'DATETIME'
},
...
...
@@ -322,7 +322,7 @@ use constant ABSTRACT_SCHEMA => {
bug_when
=>
{
TYPE
=>
'DATETIME'
,
NOTNULL
=>
1
},
work_time
=>
{
TYPE
=>
'decimal(5,2)'
,
NOTNULL
=>
1
,
DEFAULT
=>
'0'
},
thetext
=>
{
TYPE
=>
'
MEDIUM
TEXT'
,
NOTNULL
=>
1
},
thetext
=>
{
TYPE
=>
'
LONG
TEXT'
,
NOTNULL
=>
1
},
isprivate
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'FALSE'
},
already_wrapped
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
...
...
@@ -373,8 +373,8 @@ use constant ABSTRACT_SCHEMA => {
bug_id
=>
{
TYPE
=>
'INT3'
,
NOTNULL
=>
1
},
creation_ts
=>
{
TYPE
=>
'DATETIME'
,
NOTNULL
=>
1
},
modification_time
=>
{
TYPE
=>
'DATETIME'
,
NOTNULL
=>
1
},
description
=>
{
TYPE
=>
'
MEDIUM
TEXT'
,
NOTNULL
=>
1
},
mimetype
=>
{
TYPE
=>
'
MEDIUM
TEXT'
,
NOTNULL
=>
1
},
description
=>
{
TYPE
=>
'
TINY
TEXT'
,
NOTNULL
=>
1
},
mimetype
=>
{
TYPE
=>
'
TINY
TEXT'
,
NOTNULL
=>
1
},
ispatch
=>
{
TYPE
=>
'BOOLEAN'
},
filename
=>
{
TYPE
=>
'varchar(100)'
,
NOTNULL
=>
1
},
submitter_id
=>
{
TYPE
=>
'INT3'
,
NOTNULL
=>
1
,
...
...
@@ -469,7 +469,7 @@ use constant ABSTRACT_SCHEMA => {
id
=>
{
TYPE
=>
'SMALLSERIAL'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
},
name
=>
{
TYPE
=>
'varchar(50)'
,
NOTNULL
=>
1
},
description
=>
{
TYPE
=>
'TEXT'
},
description
=>
{
TYPE
=>
'
MEDIUM
TEXT'
},
cc_list
=>
{
TYPE
=>
'varchar(200)'
},
target_type
=>
{
TYPE
=>
'char(1)'
,
NOTNULL
=>
1
,
DEFAULT
=>
"'b'"
},
...
...
@@ -527,7 +527,7 @@ use constant ABSTRACT_SCHEMA => {
DEFAULT
=>
FIELD_TYPE_UNKNOWN
},
custom
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'FALSE'
},
description
=>
{
TYPE
=>
'
MEDIUM
TEXT'
,
NOTNULL
=>
1
},
description
=>
{
TYPE
=>
'
TINY
TEXT'
,
NOTNULL
=>
1
},
mailhead
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'FALSE'
},
sortkey
=>
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
},
...
...
@@ -781,7 +781,7 @@ use constant ABSTRACT_SCHEMA => {
COLUMN
=>
'userid'
,
DELETE
=>
'CASCADE'
}},
name
=>
{
TYPE
=>
'varchar(64)'
,
NOTNULL
=>
1
},
query
=>
{
TYPE
=>
'
MEDIUM
TEXT'
,
NOTNULL
=>
1
},
query
=>
{
TYPE
=>
'
LONG
TEXT'
,
NOTNULL
=>
1
},
query_type
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
},
],
INDEXES
=>
[
...
...
@@ -869,7 +869,7 @@ use constant ABSTRACT_SCHEMA => {
id
=>
{
TYPE
=>
'MEDIUMSERIAL'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
},
name
=>
{
TYPE
=>
'varchar(255)'
,
NOTNULL
=>
1
},
description
=>
{
TYPE
=>
'TEXT'
,
NOTNULL
=>
1
},
description
=>
{
TYPE
=>
'
MEDIUM
TEXT'
,
NOTNULL
=>
1
},
isbuggroup
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
},
userregexp
=>
{
TYPE
=>
'TINYTEXT'
,
NOTNULL
=>
1
,
DEFAULT
=>
"''"
},
...
...
@@ -1067,7 +1067,7 @@ use constant ABSTRACT_SCHEMA => {
name
=>
{
TYPE
=>
'varchar(64)'
,
NOTNULL
=>
1
},
frequency
=>
{
TYPE
=>
'INT2'
,
NOTNULL
=>
1
},
last_viewed
=>
{
TYPE
=>
'DATETIME'
},
query
=>
{
TYPE
=>
'
MEDIUM
TEXT'
,
NOTNULL
=>
1
},
query
=>
{
TYPE
=>
'
LONG
TEXT'
,
NOTNULL
=>
1
},
is_public
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'FALSE'
},
],
...
...
@@ -1169,7 +1169,7 @@ use constant ABSTRACT_SCHEMA => {
quipid
=>
{
TYPE
=>
'MEDIUMSERIAL'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
},
userid
=>
{
TYPE
=>
'INT3'
},
quip
=>
{
TYPE
=>
'TEXT'
,
NOTNULL
=>
1
},
quip
=>
{
TYPE
=>
'
MEDIUM
TEXT'
,
NOTNULL
=>
1
},
approved
=>
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'TRUE'
},
],
...
...
@@ -2475,18 +2475,16 @@ An auto-increment L</INT4>
=item C<TINYTEXT>
Variable length string of characters up to 255 (2^8 - 1) characters wide
or more depending on the character set used.
Variable length string of characters up to 255 (2^8 - 1) characters wide.
=item C<MEDIUMTEXT>
Variable length string of characters up to
16M (2^24 - 1) characters wide
or more depending on the character set used
.
Variable length string of characters up to
4000 characters wide.
May be longer on some databases
.
=item C<TEXT>
=item C<
LONG
TEXT>
Variable length string of characters up to 64K (2^16 - 1) characters wide
or more depending on the character set used.
Variable length string of characters up to 16M (2^24 - 1) characters wide.
=item C<LONGBLOB>
...
...
Bugzilla/DB/Schema/Mysql.pm
View file @
961cc62c
...
...
@@ -81,6 +81,7 @@ use constant REVERSE_MAPPING => {
SMALLINT
=>
'INT2'
,
MEDIUMINT
=>
'INT3'
,
INTEGER
=>
'INT4'
,
# All the other types have the same name in their abstract version
# as in their db-specific version, so no reverse mapping is needed.
};
...
...
@@ -111,7 +112,7 @@ sub _initialize {
TINYTEXT
=>
'tinytext'
,
MEDIUMTEXT
=>
'mediumtext'
,
TEXT
=>
'
text'
,
LONGTEXT
=>
'medium
text'
,
LONGBLOB
=>
'longblob'
,
...
...
Bugzilla/DB/Schema/Pg.pm
View file @
961cc62c
...
...
@@ -75,7 +75,7 @@ sub _initialize {
TINYTEXT
=>
'varchar(255)'
,
MEDIUMTEXT
=>
'text'
,
TEXT
=>
'text'
,
LONGTEXT
=>
'text'
,
LONGBLOB
=>
'bytea'
,
...
...
Bugzilla/Install/DB.pm
View file @
961cc62c
...
...
@@ -24,7 +24,7 @@ use strict;
use
Bugzilla::
Constants
;
use
Bugzilla::
Hook
;
use
Bugzilla::Install::
Util
qw(indicate_progress)
;
use
Bugzilla::Install::
Util
qw(indicate_progress
install_string
)
;
use
Bugzilla::
Util
;
use
Bugzilla::
Series
;
...
...
@@ -483,7 +483,7 @@ sub update_table_definitions {
$dbh
->
bz_add_column
(
'setting'
,
'subclass'
,
{
TYPE
=>
'varchar(32)'
});
$dbh
->
bz_alter_column
(
'longdescs'
,
'thetext'
,
{
TYPE
=>
'MEDIUMTEXT'
,
NOTNULL
=>
1
},
''
);
{
TYPE
=>
'LONGTEXT'
,
NOTNULL
=>
1
},
''
);
# 2006-10-20 LpSolit@gmail.com - Bug 189627
$dbh
->
bz_add_column
(
'group_control_map'
,
'editcomponents'
,
...
...
@@ -514,6 +514,9 @@ sub update_table_definitions {
# 2007-08-21 wurblzap@gmail.com - Bug 365378
_make_lang_setting_dynamic
();
# 2007-11-29 xiaoou.wu@oracle.com - Bug 153129
change_text_types
();
# 2007-09-09 LpSolit@gmail.com - Bug 99215
_fix_attachment_modification_date
();
...
...
@@ -2930,6 +2933,62 @@ sub _fix_attachment_modification_date {
[
qw(modification_time)
]);
}
sub
change_text_types
{
my
$dbh
=
Bugzilla
->
dbh
;
return
if
$dbh
->
bz_column_info
(
'series'
,
'query'
)
->
{
TYPE
}
eq
'LONGTEXT'
;
_check_content_length
(
'attachments'
,
'mimetype'
,
255
);
_check_content_length
(
'fielddefs'
,
'description'
,
255
);
_check_content_length
(
'attachments'
,
'description'
,
255
);
$dbh
->
bz_alter_column
(
'bugs'
,
'bug_file_loc'
,
{
TYPE
=>
'MEDIUMTEXT'
});
$dbh
->
bz_alter_column
(
'longdescs'
,
'thetext'
,
{
TYPE
=>
'LONGTEXT'
,
NOTNULL
=>
1
});
$dbh
->
bz_alter_column
(
'attachments'
,
'description'
,
{
TYPE
=>
'TINYTEXT'
,
NOTNULL
=>
1
});
$dbh
->
bz_alter_column
(
'attachments'
,
'mimetype'
,
{
TYPE
=>
'TINYTEXT'
,
NOTNULL
=>
1
});
$dbh
->
bz_alter_column
(
'flagtypes'
,
'description'
,
{
TYPE
=>
'MEDIUMTEXT'
,
NOTNULL
=>
1
});
$dbh
->
bz_alter_column
(
'fielddefs'
,
'description'
,
{
TYPE
=>
'TINYTEXT'
,
NOTNULL
=>
1
});
$dbh
->
bz_alter_column
(
'namedqueries'
,
'query'
,
{
TYPE
=>
'LONGTEXT'
,
NOTNULL
=>
1
});
$dbh
->
bz_alter_column
(
'groups'
,
'description'
,
{
TYPE
=>
'MEDIUMTEXT'
,
NOTNULL
=>
1
});
$dbh
->
bz_alter_column
(
'quips'
,
'quip'
,
{
TYPE
=>
'MEDIUMTEXT'
,
NOTNULL
=>
1
});
$dbh
->
bz_alter_column
(
'series'
,
'query'
,
{
TYPE
=>
'LONGTEXT'
,
NOTNULL
=>
1
});
}
sub
_check_content_length
{
my
(
$table_name
,
$field_name
,
$max_length
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$contents
=
$dbh
->
selectcol_arrayref
(
"SELECT $field_name FROM $table_name
WHERE LENGTH($field_name) > ?"
,
undef
,
$max_length
);
if
(
@$contents
)
{
my
@trimmed
;
foreach
my
$item
(
@$contents
)
{
# Don't dump the whole string--it could be 16MB.
if
(
length
(
$item
)
>
80
)
{
push
(
@trimmed
,
substr
(
$item
,
0
,
30
)
.
"..."
.
substr
(
$item
,
-
30
)
.
"\n"
);
}
else
{
push
(
@trimmed
,
$item
);
}
}
print
install_string
(
'install_data_too_long'
,
{
column
=>
$field_name
,
table
=>
$table_name
,
max_length
=>
$max_length
,
data
=>
join
(
"\n"
,
@trimmed
)
});
exit
3
;
}
}
1
;
__END__
...
...
template/en/default/setup/strings.txt.pl
View file @
961cc62c
...
...
@@ -43,6 +43,13 @@ with one command, do:
##perl## install-module.pl --all
EOT
install_data_length_too_long
=>
<<
EOT
,
WARNING:
Some
of
the
data
in
the
##table##.##column## column is longer than
its
new
length
limit
of
##max_length## characters. Please fix this data
and
then
re
-
run
checksetup
.
pl:
##data##
EOT
install_module
=>
'Installing ##module## version ##version##...'
,
module_found
=>
"found v##ver##"
,
module_not_found
=>
"not found"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment