1. Relate to TABLE attachments need to change list below: 1.1 Separate thedata from the table attachemts to a new table attach_data. Added : TABLE attach_data Removed: FIELD attachments.thedata A) File: attachment.cgi Line: 526 Func: view() Statement: my $query="SELECT mimetype, filename, thedata FROM attachments WHERE attach_id = $::FORM{'id'}"; B) File: attachment.cgi Line: 631 Func: get_unified_diff() Statement: SendSQL("SELECT bug_id, description, ispatch, thedata FROM attachments WHERE attach_id = $id"); C) File: attachment.cgi Line: 764 Func: diff() Statement: SendSQL("SELECT bug_id, description, ispatch, thedata FROM attachments WHERE attach_id = $::FORM{'id'}"); D) File: attachment.cgi Line: 836 Func: viewall() Statement: SendSQL("SELECT attach_id, " . Bugzilla::DB::DateFormat('creation_ts', '%Y.%m.%d %H:%i') . ", mimetype, description, ispatch, isobsolete, isprivate, " . Bugzilla::DB::Length('thedata', 'base64') . " FROM attachments WHERE bug_id = $::FORM{'bugid'} $privacy ORDER BY attach_id"); E) File: attachment.cgi Line:945 Func: insert() Statement: my $query="INSERT INTO attachments (bug_id, creation_ts, filename, description, mimetype, ispatch, isprivate, submitter_id, thedata) VALUES ($::FORM{'bugid'}, now(), $sqlfilename, $description, $contenttype, $::FORM{'ispatch'},$isprivate, $::userid, ?)"; F) File: attachment.cgi Line:1068 Func: edit() Statement: SendSQL("SELECT description, mimetype, filename, bug_id, ispatch, isobsolete, isprivate, " . Bugzilla::DB::Length('thedata', 'base64') . " FROM attachments WHERE attach_id = $::FORM{'id'}"); G) File: Bugzilla/Attachment.pm Line:55 Func: query() Statement: &::SendSQL(" SELECT attach_id, " . Bugzilla::DB::DateFormat('creation_ts', '%Y.%m.%d %H:%i:%s') . ", mimetype, description, ispatch, isobsolete, isprivate, submitter_id, " . Bugzilla::DB::Length('thedata') . " FROM attachments WHERE bug_id = $bugid ORDER BY attach_id "); H) File: post.cgi Line:787 Func: if ($cgi->param('md5')) Statement: SendSQL("INSERT INTO attachments (bug_id, creation_ts, filename, description, mimetype, ispatch, isprivate, submitter_id, thedata) VALUES ($id, now(), $sqlfilename, $description, $contenttype, $ispatch , $isprivate, $::userid, $thedata)"); 1.2 New “Not NULL” Field : isurl,modification_time in the attachments table. Added : FIELD attachments.isurl, attachment.modification_time Removed : N/A A) File: attachment.cgi Line:945 Func: insert() Statement: my $query="INSERT INTO attachments (bug_id, creation_ts, filename, description, mimetype, ispatch, isprivate, submitter_id, thedata) VALUES ($::FORM{'bugid'}, now(), $sqlfilename, $description, $contenttype, $::FORM{'ispatch'},$isprivate, $::userid, ?)"; B)File: Bugzilla/Attachment.pm Line:787 Func: if ($cgi->param('md5')) Statement: SendSQL("INSERT INTO attachments (bug_id, creation_ts, filename, description, mimetype, ispatch, isprivate, submitter_id, thedata) VALUES ($id, now(), $sqlfilename, $description, $contenttype, $ispatch , $isprivate, $::userid, $thedata)");
Created attachment 303412 [details] The patch to fix the "Add attah_data table "
Hi nicho, maybe other places where thedata also need to be changed to belong to the table attach_data and not attachments are: ./quicksearchhack.html:236: <td>Attachment Data <i>("attachments.thedata")</i></td> ./post.cgi:778: my $thedata = SqlQuote($data); ./post.cgi:787: SendSQL("INSERT INTO attachments (bug_id, creation_ts, filename, description, mimetype, ispatch, isprivate, submitter_id, thedata) ./post.cgi:788: VALUES ($id, now(), $sqlfilename, $description, $contenttype, $ispatch , $isprivate, $::userid, $thedata)"); ./quicksearch.js:154:add_mapping("attachmentdata", "attachments.thedata"); ./quicksearch.js:155:add_mapping("attachdata", "attachments.thedata"); ./importResultRPMS_direct.pl:50: "mimetype, ispatch, isprivate, submitter_id, thedata, it_id) " . ./importResultRPMS_direct.pl:54: $bugs_dbh->do($query, undef, $thedata); please note that the above info includes the file number in the file where the code needs to be changed. Cheers, Noura
> please note that the above info includes the file number in the file where the > code needs to be changed. > s/file number/line number :)
importResultRPMS_direct.pl should probably be deprecated now; IIRC it's only use was the one time migration from flat files to bugzilla attachments for the results rpms.
Created attachment 304124 [details] Patch Improve: Add the post.cgi which is leaked to put into patch last time. Thanks a lot, Noura,
./quicksearch.js and ./quicksearchhack.html are not used in the hwcert catalog,So we can leave it alone. Noura : Thanks a lot!
if they exist in the hwcert tree we should go ahead and update them. It's ok with me to either update them with the schema changes or to remove the functionality which references the schema changes or to deprecate the files from the repo.
Created attachment 304248 [details] Patch Improve: Add the new update (changes) in the quicksearch.js and quicksearchhack.html which Noura has motioned. :) Pls review.
The patch looks good to me nicho :) Thanks, Noura
Please commit this change to CVS and set the status to MODIFIED.
tested and run good