From 1f0821b68be37eb84b5579e987c014d92abd8c42 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 8 Dec 2016 10:16:29 +0000 Subject: [PATCH] Bug 17762: DB changes - Add new 'lang' columns to letter and borrowers tables Sponsored-by: Orex Digital Signed-off-by: Hugo Agud --- installer/data/mysql/atomicupdate/bug_xxxxx.perl | 15 +++++++++++++++ installer/data/mysql/kohastructure.sql | 3 +++ 2 files changed, 18 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_xxxxx.perl diff --git a/installer/data/mysql/atomicupdate/bug_xxxxx.perl b/installer/data/mysql/atomicupdate/bug_xxxxx.perl new file mode 100644 index 0000000..b2e32ae --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_xxxxx.perl @@ -0,0 +1,15 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + + if( !column_exists( 'letter', 'lang' ) ) { + $dbh->do( "ALTER TABLE letter ADD COLUMN lang VARCHAR(25) NOT NULL DEFAULT 'default' AFTER message_transport_type" ); + } + + if( !column_exists( 'borrowers', 'lang' ) ) { + $dbh->do( "ALTER TABLE borrowers ADD COLUMN lang VARCHAR(25) NOT NULL DEFAULT 'default' AFTER lastseen" ); + $dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN lang VARCHAR(25) NOT NULL DEFAULT 'default' AFTER lastseen" ); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - Add columns letter.lang and borrowers.lang to allow translation of notices)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 40f0d88..d32e226 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -631,6 +631,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'. `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others) `lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface) + `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron `overdrive_auth_token` text default NULL, -- persist OverDrive auth token KEY borrowernumber (borrowernumber), KEY `cardnumber` (`cardnumber`), @@ -1657,6 +1658,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons `checkprevcheckout` varchar(7) NOT NULL default 'inherit', -- produce a warning for this patron if this item has previously been checked out to this patron if 'yes', not if 'no', defer to category setting if 'inherit'. `updated_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others) `lastseen` datetime default NULL, -- last time a patron has been seed (connected at the OPAC or staff interface) + `lang` varchar(25) NOT NULL default 'default', -- lang to use to send notices to this patron `overdrive_auth_token` text default NULL, -- persist OverDrive auth token UNIQUE KEY `cardnumber` (`cardnumber`), PRIMARY KEY `borrowernumber` (`borrowernumber`), @@ -2530,6 +2532,7 @@ CREATE TABLE `letter` ( -- table for all notice templates in Koha `title` varchar(200) NOT NULL default '', -- subject line of the notice `content` text, -- body text for the notice or slip `message_transport_type` varchar(20) NOT NULL DEFAULT 'email', -- transport type for this notice + `lang` varchar(25) NOT NULL DEFAULT 'default', -- lang of the notice PRIMARY KEY (`module`,`code`, `branchcode`, `message_transport_type`), CONSTRAINT `message_transport_type_fk` FOREIGN KEY (`message_transport_type`) REFERENCES `message_transport_types` (`message_transport_type`) ON DELETE CASCADE ON UPDATE CASCADE -- 2.9.3