Bugzilla – Attachment 36100 Details for
Bug 13743
Primary key for issues-table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13743 - Primary key for issues-table
Bug-13743---Primary-key-for-issues-table.patch (text/plain), 3.81 KB, created by
Olli-Antti Kivilahti
on 2015-02-20 17:34:59 UTC
(
hide
)
Description:
Bug 13743 - Primary key for issues-table
Filename:
MIME Type:
Creator:
Olli-Antti Kivilahti
Created:
2015-02-20 17:34:59 UTC
Size:
3.81 KB
patch
obsolete
>From 271ff6275f6d880f7fd0543dcb8a2036a7452f31 Mon Sep 17 00:00:00 2001 >From: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> >Date: Fri, 20 Feb 2015 19:31:39 +0200 >Subject: [PATCH] Bug 13743 - Primary key for issues-table > >Each table must have a primary key. >This makes extending issues-related functionality much easier. > >TEST PLAN: > >1. Check-out Items for you. >2. Check-in Items from you. >3. Check-out using the SIP2-server. >4. Check-in using the SIP2-server. >--- > installer/data/mysql/kohastructure.sql | 4 ++++ > installer/data/mysql/updatedatabase.pl | 8 ++++++++ > 2 files changed, 12 insertions(+) > >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index cd83f99..ac69474 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1140,6 +1140,7 @@ CREATE TABLE `import_items` ( > > DROP TABLE IF EXISTS `issues`; > CREATE TABLE `issues` ( -- information related to check outs or issues >+ `id` int(12) NOT NULL auto_increment, > `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to > `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out > `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss) >@@ -1153,6 +1154,7 @@ CREATE TABLE `issues` ( -- information related to check outs or issues > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched > `issuedate` datetime default NULL, -- date the item was checked out or issued > `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag >+ PRIMARY KEY (`id`), > KEY `issuesborridx` (`borrowernumber`), > KEY `itemnumber_idx` (`itemnumber`), > KEY `branchcode_idx` (`branchcode`), >@@ -1614,6 +1616,7 @@ CREATE TABLE `oai_sets_biblios` ( > > DROP TABLE IF EXISTS `old_issues`; > CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned >+ `id` int(12) NOT NULL auto_increment, > `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to > `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out > `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd) >@@ -1627,6 +1630,7 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r > `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched > `issuedate` datetime default NULL, -- date the item was checked out or issued > `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag >+ PRIMARY KEY (`id`), > KEY `old_issuesborridx` (`borrowernumber`), > KEY `old_issuesitemidx` (`itemnumber`), > KEY `branchcode_idx` (`branchcode`), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index ad8ec97..667c6b0 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6661,6 +6661,14 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.19.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("ALTER TABLE issues ADD COLUMN id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (id);"); >+ $dbh->do("ALTER TABLE old_issues ADD COLUMN id int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (id);"); >+ print "Upgrade to $DBversion done (Bug 13743 - Primary key for issues-table)\n"; >+ SetVersion ($DBversion); >+} >+ > $DBversion = "3.11.00.108"; > if ( CheckVersion($DBversion) ) { > $dbh->do("ALTER TABLE action_logs CHANGE timestamp timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;"); >-- >1.7.9.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13743
:
36100
|
36101
|
36102
|
37060