summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Install
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-07-09 08:24:47 +0200
committerByron Jones <glob@mozilla.com>2015-07-09 08:24:47 +0200
commit28ac958d3cf5951a2e75d53581d6ddd4ded30119 (patch)
tree7414367c927ef0784ba5dd25426ed7f83d5f5053 /Bugzilla/Install
parentcd60ea7d685158bf9b024ccf940af3835a6a769c (diff)
downloadbugzilla-28ac958d3cf5951a2e75d53581d6ddd4ded30119.tar.gz
bugzilla-28ac958d3cf5951a2e75d53581d6ddd4ded30119.tar.xz
Bug 1180570: store attachment size in the database
Diffstat (limited to 'Bugzilla/Install')
-rw-r--r--Bugzilla/Install/DB.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 7e7362443..92015f22f 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -730,6 +730,8 @@ sub update_table_definitions {
$dbh->bz_add_index('user_api_keys', 'user_api_keys_user_id_app_id_idx',
[qw(user_id app_id)]);
+ _add_attach_size();
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -3829,6 +3831,22 @@ sub _fix_user_api_keys_indexes {
}
}
+sub _add_attach_size {
+ my $dbh = Bugzilla->dbh;
+
+ return if $dbh->bz_column_info('attachments', 'attach_size');
+
+ $dbh->bz_add_column('attachments', 'attach_size',
+ {TYPE => 'INT4', NOTNULL => 1, DEFAULT => 0});
+
+ print "Setting attach_size...\n";
+ $dbh->do("
+ UPDATE attachments
+ INNER JOIN attach_data ON attach_data.id = attachments.attach_id
+ SET attachments.attach_size = LENGTH(attach_data.thedata)
+ ");
+}
+
1;
__END__