From 74118daa82885bacd427148b57ff1d04a33136cb Mon Sep 17 00:00:00 2001 From: Andrew Moore Date: Wed, 9 Jul 2008 11:56:39 -0500 Subject: [PATCH] bug 2274 [1/5] database changes (DB rev 097) to add email address to message_queue table I added three fields to the message_queue table: - to_address - from_address - content_type: necessary to hold email header for attachments I changed one field in message_queue: - borrowernumber can now be NULL for messages sent to the admin These can be used to override the default addresses used. By default, emails are sent to the borrowers.email address and sent from the KohaAdminEmailAddress syspref address. These values are still used if the to_address or from_address values are NULL. These changes are necessary to let overdue_notices.pl be backwards compatible. Signed-off-by: Joshua Ferraro --- installer/data/mysql/kohastructure.sql | 6 ++++-- installer/data/mysql/updatedatabase.pl | 13 +++++++++++++ kohaversion.pl | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index f652e503e4..dcc8dc0c6c 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2176,15 +2176,17 @@ CREATE TABLE `tmp_holdsqueue` ( -- Table structure for table `message_queue` -- -DROP TABLE if EXISTS `message_queue`; CREATE TABLE `message_queue` ( `message_id` int(11) NOT NULL auto_increment, - `borrowernumber` int(11) NOT NULL, + `borrowernumber` int(11) default NULL, `subject` text, `content` text, `message_transport_type` varchar(20) NOT NULL, `status` enum('sent','pending','failed','deleted') NOT NULL default 'pending', `time_queued` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + `to_address` mediumtext, + `from_address` mediumtext, + `content_type` text, KEY `message_id` (`message_id`), KEY `borrowernumber` (`borrowernumber`), KEY `message_transport_type` (`message_transport_type`), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e008b6fa10..83e6c44ff4 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -1835,6 +1835,19 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { print "Upgrade to $DBversion done (fix name borrower_message_preferences.wants_digest)\n"; SetVersion ($DBversion); } + +$DBversion = '3.00.00.097'; +if ( C4::Context->preference('Version') < TransformToNum($DBversion) ) { + + $dbh->do('ALTER TABLE message_queue ADD to_address mediumtext default NULL'); + $dbh->do('ALTER TABLE message_queue ADD from_address mediumtext default NULL'); + $dbh->do('ALTER TABLE message_queue ADD content_type text'); + $dbh->do('ALTER TABLE message_queue CHANGE borrowernumber borrowernumber int(11) default NULL'); + + print "Upgrade to $DBversion done (updating 4 fields in message_queue table)\n"; + SetVersion($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/kohaversion.pl b/kohaversion.pl index a3b0213b55..71c822fb81 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = "3.00.00.096"; + our $VERSION = "3.00.00.097"; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5