View | Details | Raw Unified | Return to bug 18185
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_18185.perl (+10 lines)
Line 0 Link Here
1
$DBversion = 'XXX';  # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    unless ( column_exists( 'old_issues', 'id' ) ) {
4
        $dbh->do(q|ALTER TABLE old_issues DROP PRIMARY KEY|);
5
        $dbh->do(q|ALTER TABLE old_issues ADD COLUMN id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST|);
6
    }
7
8
    SetVersion( $DBversion );
9
    print "Upgrade to $DBversion done (Bug 18185 - Add new column old_issues.id as primary key)\n";
10
}
(-)a/installer/data/mysql/kohastructure.sql (-3 / +3 lines)
Lines 1763-1769 CREATE TABLE `issues` ( -- information related to check outs or issues Link Here
1763
1763
1764
DROP TABLE IF EXISTS `old_issues`;
1764
DROP TABLE IF EXISTS `old_issues`;
1765
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1765
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1766
  `issue_id` int(11) NOT NULL, -- primary key for issues table
1766
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key for old_issues table
1767
  `issue_id` int(11) NOT NULL, -- primary key from the issues table
1767
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1768
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1768
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1769
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1769
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
1770
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
Lines 1776-1782 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r Link Here
1776
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1777
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1777
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1778
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1778
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1779
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1779
  PRIMARY KEY (`issue_id`),
1780
  PRIMARY KEY (`id`),
1780
  KEY `old_issuesborridx` (`borrowernumber`),
1781
  KEY `old_issuesborridx` (`borrowernumber`),
1781
  KEY `old_issuesitemidx` (`itemnumber`),
1782
  KEY `old_issuesitemidx` (`itemnumber`),
1782
  KEY `branchcode_idx` (`branchcode`),
1783
  KEY `branchcode_idx` (`branchcode`),
1783
- 

Return to bug 18185