diff options
author | bugreport%peshkin.net <> | 2005-08-27 06:11:30 +0000 |
---|---|---|
committer | bugreport%peshkin.net <> | 2005-08-27 06:11:30 +0000 |
commit | bc7607c1c4e31b9583a6a772c41567c1b1928e6d (patch) | |
tree | 3b370d740050b6bb2ec9013f374802585170f409 /checksetup.pl | |
parent | d8a52b79b5b12e2e002614bc0aea343a9a535258 (diff) | |
download | bugs-bc7607c1c4e31b9583a6a772c41567c1b1928e6d.tar bugs-bc7607c1c4e31b9583a6a772c41567c1b1928e6d.tar.gz bugs-bc7607c1c4e31b9583a6a772c41567c1b1928e6d.tar.bz2 bugs-bc7607c1c4e31b9583a6a772c41567c1b1928e6d.tar.xz bugs-bc7607c1c4e31b9583a6a772c41567c1b1928e6d.zip |
Bug 305333: Move attachments.thedata to its own table
Patch by Joel Peshkin <bugreport@peshkin.net>
r=lpsolit, a=justdave
Diffstat (limited to 'checksetup.pl')
-rwxr-xr-x | checksetup.pl | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/checksetup.pl b/checksetup.pl index 7e57587a5..5fe6cea97 100755 --- a/checksetup.pl +++ b/checksetup.pl @@ -1702,7 +1702,6 @@ AddFDef("cc", "CC", 1); AddFDef("dependson", "BugsThisDependsOn", 1); AddFDef("blocked", "OtherBugsDependingOnThis", 1); AddFDef("attachments.description", "Attachment description", 0); -AddFDef("attachments.thedata", "Attachment data", 0); AddFDef("attachments.filename", "Attachment filename", 0); AddFDef("attachments.mimetype", "Attachment mime type", 0); AddFDef("attachments.ispatch", "Attachment is patch", 0); @@ -1740,6 +1739,9 @@ AddFDef("percentage_complete", "Percentage Complete", 0); AddFDef("content", "Content", 0); +$dbh->do("DELETE FROM fielddefs WHERE name='attachments.thedata'"); +AddFDef("attach_data.thedata", "Attachment data", 0); + ########################################################################### # Detect changed local settings ########################################################################### @@ -4009,6 +4011,27 @@ if ($dbh->bz_index_info('attachments', 'attachments_submitter_id_idx') $dbh->bz_add_index('attachments', 'attachments_submitter_id_idx', [qw(submitter_id bug_id)]); +# 2005-08-25 - bugreport@peshkin.net - Bug 305333 +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->bz_drop_column("attachments", "thedata"); +} + + # If you had to change the --TABLE-- definition in any way, then add your # differential change code *** A B O V E *** this comment. # @@ -4134,7 +4157,6 @@ add_setting ('csv_colsepchar', {',' => 1, ';' => 2 }, ',' ); # Create Administrator --ADMIN-- ########################################################################### - sub bailout { # this is just in case we get interrupted while getting passwd if ($^O !~ /MSWin32/i) { system("stty","echo"); # re-enable input echoing |