Bugzilla – Attachment 43584 Details for
Bug 13624
Remove columns branchcode, categorytype from table overduerules_transport_types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13624 - Tidying the atomicupdate file and kohastructure.sql
Bug-13624---Tidying-the-atomicupdate-file-and-koha.patch (text/plain), 6.04 KB, created by
Jonathan Druart
on 2015-10-19 09:19:52 UTC
(
hide
)
Description:
Bug 13624 - Tidying the atomicupdate file and kohastructure.sql
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-10-19 09:19:52 UTC
Size:
6.04 KB
patch
obsolete
>From 92059bb712637586631db3550147cd69f4c10871 Mon Sep 17 00:00:00 2001 >From: Blou <philippe.blouin@inlibro.com> >Date: Fri, 5 Jun 2015 15:06:36 -0400 >Subject: [PATCH] Bug 13624 - Tidying the atomicupdate file and > kohastructure.sql > >Signed-off-by: Martin Persson <xarragon@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../update_13624_overduerules_transport_type.pl | 15 ++++++++------- > installer/data/mysql/kohastructure.sql | 7 ++++--- > 2 files changed, 12 insertions(+), 10 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/update_13624_overduerules_transport_type.pl b/installer/data/mysql/atomicupdate/update_13624_overduerules_transport_type.pl >index a1ac778..be3af3c 100755 >--- a/installer/data/mysql/atomicupdate/update_13624_overduerules_transport_type.pl >+++ b/installer/data/mysql/atomicupdate/update_13624_overduerules_transport_type.pl >@@ -5,13 +5,13 @@ use warnings; > use C4::Context; > my $dbh=C4::Context->dbh; > >-print "Will do : Upgrade to $DBversion done (Bug 13624 - Remove columns branchcode, categorytype from table overduerules_transport_types)\n"; >+print "Will do : Bug 13624 - Remove columns branchcode, categorytype from table overduerules_transport_types\n"; > > #if ( CheckVersion($DBversion) ) { > $dbh->do("SET FOREIGN_KEY_CHECKS=0"); > $dbh->do("ALTER TABLE overduerules RENAME old_overduerules"); > $dbh->do("CREATE TABLE overduerules ( >- `overduerules_id` mediumint NOT NULL AUTO_INCREMENT, >+ `overduerules_id` int(11) NOT NULL AUTO_INCREMENT, > `branchcode` varchar(10) NOT NULL DEFAULT '', > `categorycode` varchar(10) NOT NULL DEFAULT '', > `delay1` int(4) DEFAULT NULL, >@@ -23,21 +23,22 @@ print "Will do : Upgrade to $DBversion done (Bug 13624 - Remove columns branchco > `delay3` int(4) DEFAULT NULL, > `letter3` varchar(20) DEFAULT NULL, > `debarred3` int(1) DEFAULT '0', >- PRIMARY KEY (`overduerules_id`) >+ PRIMARY KEY (`overduerules_id`), >+ UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); > $dbh->do("INSERT INTO overduerules(branchcode, categorycode, delay1, letter1, debarred1, delay2, debarred2, letter2, delay3, letter3, debarred3) SELECT * FROM old_overduerules"); > $dbh->do("DROP TABLE old_overduerules"); > $dbh->do("ALTER TABLE overduerules_transport_types >- ADD COLUMN overduerules_id mediumint NOT NULL"); >- my $mtts = $dbh->selectall_arrayref("select * from overduerules_transport_types", { Slice => {} }); >+ ADD COLUMN overduerules_id int(11) NOT NULL"); >+ my $mtts = $dbh->selectall_arrayref("SELECT * FROM overduerules_transport_types", { Slice => {} }); > $dbh->do("DELETE FROM overduerules_transport_types"); > $dbh->do("ALTER TABLE overduerules_transport_types > DROP FOREIGN KEY overduerules_fk, > ADD FOREIGN KEY overduerules_transport_types_fk (overduerules_id) REFERENCES overduerules (overduerules_id) ON DELETE CASCADE ON UPDATE CASCADE, > DROP COLUMN branchcode, > DROP COLUMN categorycode"); >- my $s = $dbh->prepare("insert into overduerules_transport_types (overduerules_id, id, letternumber, message_transport_type) " >- ." values((SELECT overduerules_id FROM overduerules WHERE branchcode = ? AND categorycode = ?),?,?,?)"); >+ my $s = $dbh->prepare("INSERT INTO overduerules_transport_types (overduerules_id, id, letternumber, message_transport_type) " >+ ." VALUES((SELECT overduerules_id FROM overduerules WHERE branchcode = ? AND categorycode = ?),?,?,?)"); > foreach my $mtt(@$mtts){ > $s->execute($mtt->{branchcode}, $mtt->{categorycode}, $mtt->{id}, $mtt->{letternumber}, $mtt->{message_transport_type} ); > } >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 78dadc4..c169833 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1696,7 +1696,7 @@ CREATE TABLE `opac_news` ( -- data from the news tool > > DROP TABLE IF EXISTS `overduerules`; > CREATE TABLE `overduerules` ( -- overdue notice status and triggers >- `overduerules_id` mediumint NOT NULL AUTO_INCREMENT, -- unique identifier for the overduerules >+ `overduerules_id` int(11) NOT NULL AUTO_INCREMENT, -- unique identifier for the overduerules > `branchcode` varchar(10) NOT NULL default '', -- foreign key from the branches table to define which branch this rule is for (if blank it's all libraries) > `categorycode` varchar(10) NOT NULL default '', -- foreign key from the categories table to define which patron category this rule is for > `delay1` int(4) default NULL, -- number of days after the item is overdue that the first notice is sent >@@ -1708,7 +1708,8 @@ CREATE TABLE `overduerules` ( -- overdue notice status and triggers > `delay3` int(4) default NULL, -- number of days after the item is overdue that the third notice is sent > `letter3` varchar(20) default NULL, -- foreign key from the letter table to define which notice should be sent as the third notice > `debarred3` int(1) default 0, -- is the patron restricted when the third notice is sent (1 for yes, 0 for no) >- PRIMARY KEY (`overduerules_id`) >+ PRIMARY KEY (`overduerules_id`), >+ UNIQUE KEY `overduerules_branch_cat` (`branchcode`,`categorycode`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; > > -- >@@ -2570,7 +2571,7 @@ DROP TABLE IF EXISTS `overduerules_transport_types`; > CREATE TABLE overduerules_transport_types( > `id` INT(11) NOT NULL AUTO_INCREMENT, > `message_transport_type` VARCHAR(20) NOT NULL DEFAULT 'email', >- `overduerules_id` mediumint NOT NULL, >+ `overduerules_id` INT(11) NOT NULL, > PRIMARY KEY (id), > CONSTRAINT overduerules_fk FOREIGN KEY (overduerules_id) REFERENCES overduerules (overduerules_id) ON DELETE CASCADE ON UPDATE CASCADE, > CONSTRAINT mtt_fk FOREIGN KEY (message_transport_type) REFERENCES message_transport_types (message_transport_type) ON DELETE CASCADE ON UPDATE CASCADE >-- >2.1.0
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 13624
:
35561
|
35587
|
36122
|
36494
|
36497
|
37074
|
38288
|
38289
|
38290
|
39920
|
40329
|
40330
|
41684
|
41685
|
43524
|
43571
|
43583
| 43584 |
43585