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

(-)a/Koha/Schema/Result/Issue.pm (-12 / +17 lines)
Lines 1-21 Link Here
1
use utf8;
2
package Koha::Schema::Result::Issue;
1
package Koha::Schema::Result::Issue;
3
2
4
# Created by DBIx::Class::Schema::Loader
3
# Created by DBIx::Class::Schema::Loader
5
# DO NOT MODIFY THE FIRST PART OF THIS FILE
4
# DO NOT MODIFY THE FIRST PART OF THIS FILE
6
5
7
=head1 NAME
8
9
Koha::Schema::Result::Issue
10
11
=cut
12
13
use strict;
6
use strict;
14
use warnings;
7
use warnings;
15
8
16
use base 'DBIx::Class::Core';
9
use base 'DBIx::Class::Core';
17
10
18
=head1 TABLE: C<issues>
11
12
=head1 NAME
13
14
Koha::Schema::Result::Issue
19
15
20
=cut
16
=cut
21
17
Lines 23-28 __PACKAGE__->table("issues"); Link Here
23
19
24
=head1 ACCESSORS
20
=head1 ACCESSORS
25
21
22
=head2 issueid
23
24
  data_type: 'integer'
25
  is_auto_increment: 1
26
  is_nullable: 0
27
26
=head2 borrowernumber
28
=head2 borrowernumber
27
29
28
  data_type: 'integer'
30
  data_type: 'integer'
Lines 104-109 __PACKAGE__->table("issues"); Link Here
104
=cut
106
=cut
105
107
106
__PACKAGE__->add_columns(
108
__PACKAGE__->add_columns(
109
  "issueid",
110
  { data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
107
  "borrowernumber",
111
  "borrowernumber",
108
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
112
  { data_type => "integer", is_foreign_key => 1, is_nullable => 1 },
109
  "itemnumber",
113
  "itemnumber",
Lines 152-157 __PACKAGE__->add_columns( Link Here
152
  "onsite_checkout",
156
  "onsite_checkout",
153
  { data_type => "integer", default_value => 0, is_nullable => 0 },
157
  { data_type => "integer", default_value => 0, is_nullable => 0 },
154
);
158
);
159
__PACKAGE__->set_primary_key("issueid");
155
160
156
=head1 RELATIONS
161
=head1 RELATIONS
157
162
Lines 170-176 __PACKAGE__->belongs_to( Link Here
170
  {
175
  {
171
    is_deferrable => 1,
176
    is_deferrable => 1,
172
    join_type     => "LEFT",
177
    join_type     => "LEFT",
173
    on_delete     => "RESTRICT",
178
    on_delete     => "CASCADE",
174
    on_update     => "CASCADE",
179
    on_update     => "CASCADE",
175
  },
180
  },
176
);
181
);
Lines 190-203 __PACKAGE__->belongs_to( Link Here
190
  {
195
  {
191
    is_deferrable => 1,
196
    is_deferrable => 1,
192
    join_type     => "LEFT",
197
    join_type     => "LEFT",
193
    on_delete     => "RESTRICT",
198
    on_delete     => "CASCADE",
194
    on_update     => "CASCADE",
199
    on_update     => "CASCADE",
195
  },
200
  },
196
);
201
);
197
202
198
203
199
# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-11-03 10:40:55
204
# Created by DBIx::Class::Schema::Loader v0.07010 @ 2015-03-20 18:56:58
200
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7Y+5IerDnajn5GLwAY5thg
205
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YErqTROKWfByx78epaGbDw
201
206
202
__PACKAGE__->belongs_to(
207
__PACKAGE__->belongs_to(
203
    "borrower",
208
    "borrower",
(-)a/installer/data/mysql/kohastructure.sql (+4 lines)
Lines 1140-1145 CREATE TABLE `import_items` ( Link Here
1140
1140
1141
DROP TABLE IF EXISTS `issues`;
1141
DROP TABLE IF EXISTS `issues`;
1142
CREATE TABLE `issues` ( -- information related to check outs or issues
1142
CREATE TABLE `issues` ( -- information related to check outs or issues
1143
  `issueid` int(12) NOT NULL auto_increment,
1143
  `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1144
  `borrowernumber` int(11), -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1144
  `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
1145
  `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out
1145
  `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
1146
  `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss)
Lines 1153-1158 CREATE TABLE `issues` ( -- information related to check outs or issues Link Here
1153
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1154
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1154
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1155
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1155
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1156
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1157
  PRIMARY KEY (`issueid`),
1156
  KEY `issuesborridx` (`borrowernumber`),
1158
  KEY `issuesborridx` (`borrowernumber`),
1157
  KEY `itemnumber_idx` (`itemnumber`),
1159
  KEY `itemnumber_idx` (`itemnumber`),
1158
  KEY `branchcode_idx` (`branchcode`),
1160
  KEY `branchcode_idx` (`branchcode`),
Lines 1614-1619 CREATE TABLE `oai_sets_biblios` ( Link Here
1614
1616
1615
DROP TABLE IF EXISTS `old_issues`;
1617
DROP TABLE IF EXISTS `old_issues`;
1616
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1618
CREATE TABLE `old_issues` ( -- lists items that were checked out and have been returned
1619
  `issueid` int(12) NOT NULL auto_increment,
1617
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1620
  `borrowernumber` int(11) default NULL, -- foreign key, linking this to the borrowers table for the patron this item was checked out to
1618
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1621
  `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out
1619
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
1622
  `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd)
Lines 1627-1632 CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r Link Here
1627
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1630
  `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, -- the date and time this record was last touched
1628
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1631
  `issuedate` datetime default NULL, -- date the item was checked out or issued
1629
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1632
  `onsite_checkout` int(1) NOT NULL default 0, -- in house use flag
1633
  PRIMARY KEY (`issueid`),
1630
  KEY `old_issuesborridx` (`borrowernumber`),
1634
  KEY `old_issuesborridx` (`borrowernumber`),
1631
  KEY `old_issuesitemidx` (`itemnumber`),
1635
  KEY `old_issuesitemidx` (`itemnumber`),
1632
  KEY `branchcode_idx` (`branchcode`),
1636
  KEY `branchcode_idx` (`branchcode`),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +8 lines)
Lines 6661-6666 if ( CheckVersion($DBversion) ) { Link Here
6661
   SetVersion ($DBversion);
6661
   SetVersion ($DBversion);
6662
}
6662
}
6663
6663
6664
$DBversion = "3.19.00.XXX";
6665
if ( CheckVersion($DBversion) ) {
6666
   $dbh->do("ALTER TABLE issues ADD COLUMN issueid int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (issueid);");
6667
   $dbh->do("ALTER TABLE old_issues ADD COLUMN issueid int(12) NOT NULL auto_increment FIRST, ADD CONSTRAINT PRIMARY KEY (issueid);");
6668
   print "Upgrade to $DBversion done (Bug 13743 - Primary key for issues-table)\n";
6669
   SetVersion ($DBversion);
6670
}
6671
6664
$DBversion = "3.11.00.108";
6672
$DBversion = "3.11.00.108";
6665
if ( CheckVersion($DBversion) ) {
6673
if ( CheckVersion($DBversion) ) {
6666
    $dbh->do("ALTER TABLE action_logs CHANGE timestamp timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;");
6674
    $dbh->do("ALTER TABLE action_logs CHANGE timestamp timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;");
6667
- 

Return to bug 13743