summaryrefslogtreecommitdiffstats
path: root/checksetup.pl
diff options
context:
space:
mode:
authorbugreport%peshkin.net <>2005-09-28 02:16:55 +0200
committerbugreport%peshkin.net <>2005-09-28 02:16:55 +0200
commit5a135a8ef7433ccb6093116e9a106263c85996f8 (patch)
treef60414d61fcc8c03120c108d5706e24d347d6afd /checksetup.pl
parentb56d5f6c828c6276449bc57bb31a00cebb592036 (diff)
downloadbugzilla-5a135a8ef7433ccb6093116e9a106263c85996f8.tar.gz
bugzilla-5a135a8ef7433ccb6093116e9a106263c85996f8.tar.xz
Bug 307602: Smooth attach_data upgrade for sites with huge attachment tables
Patch by Joel Peshkin <bugreport@peshkin.net> r=mkanat, a=justdave
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-xchecksetup.pl15
1 files changed, 2 insertions, 13 deletions
diff --git a/checksetup.pl b/checksetup.pl
index 3e84e19d3..3f4a68b78 100755
--- a/checksetup.pl
+++ b/checksetup.pl
@@ -4019,19 +4019,8 @@ $dbh->bz_add_index('attachments', 'attachments_submitter_id_idx',
if ($dbh->bz_column_info("attachments", "thedata")) {
print "Migrating attachment data to its own table...\n";
print "(This may take a very long time)\n";
- my $sth_get1 = $dbh->prepare("SELECT attach_id
- FROM attachments");
- my $sth_get2 = $dbh->prepare("SELECT thedata
- FROM attachments WHERE attach_id = ?");
- $sth_get1->execute();
- while (my ($id) = $sth_get1->fetchrow_array) {
- $sth_get2->execute($id);
- my ($thedata) = $sth_get2->fetchrow_array;
- my $sth_put = $dbh->prepare("INSERT INTO attach_data
- (id, thedata) VALUES ($id, ?)");
- $sth_put->bind_param(1, $thedata, $dbh->BLOB_TYPE);
- $sth_put->execute();
- }
+ $dbh->do("INSERT INTO attach_data (id, thedata)
+ SELECT attach_id, thedata FROM attachments");
$dbh->bz_drop_column("attachments", "thedata");
}