From 15041b7b3faae8cef0fcb392cc0934081f05a93d Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 10 Nov 2014 14:17:40 +0100 Subject: [PATCH] Bug 10459: Borrowers should have a timestamp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds a timestamp column to the borrowers table in kohastructure and updatedatabase. (And also to the deletedborrowers table.) A timestamp may be useful in synchronizing with external systems (among other reasons). Test plan: Run updatestructure on an existing database, or install a new one. Verify that the borrowers table has a timestamp now. Signed-off-by: Marcel de Rooy Tested updatestructure and running kohastructure.sql. Passed t/db_dependent/Members.t. updatedatabase.pl did not apply. I edited and then run it. Columns were added as expected. Signed-off-by: Marc Veron Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Mark Tompsett Signed-off-by: Joy Nelson Bug 10459: Follow up to update to atomic update methodology Signed-off-by: Bernardo Gonzalez Kriegel New column created, no errors. Signed-off-by: Mark Tompsett Signed-off-by: Joy Nelson Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall Signed-off-by: Kyle M Hall (cherry picked from commit 255596ae6c483caf5746745f3656b56e0ea011b4) Signed-off-by: Frédéric Demians (cherry picked from commit b4d40f7d00b38eeb006da58f016a109abae6235b) Signed-off-by: Julian Maurice --- .../atomicupdate/Bug10459_AddTimestampToBorrowers.sql | 8 ++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/Bug10459_AddTimestampToBorrowers.sql diff --git a/installer/data/mysql/atomicupdate/Bug10459_AddTimestampToBorrowers.sql b/installer/data/mysql/atomicupdate/Bug10459_AddTimestampToBorrowers.sql new file mode 100644 index 0000000000..d3eb2c4a6c --- /dev/null +++ b/installer/data/mysql/atomicupdate/Bug10459_AddTimestampToBorrowers.sql @@ -0,0 +1,8 @@ +ALTER TABLE borrowers + ADD COLUMN timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP + AFTER privacy; +ALTER TABLE deletedborrowers + ADD COLUMN timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP + ON UPDATE CURRENT_TIMESTAMP + AFTER privacy; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 855b5478d0..ee3e86dab9 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -601,6 +601,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on) `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history KEY `borrowernumber` (`borrowernumber`), + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others) KEY borrowernumber (borrowernumber), KEY `cardnumber` (`cardnumber`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -1535,6 +1536,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons `altcontactphone` varchar(50) default NULL, -- the phone number for the alternate contact for the patron/borrower `smsalertnumber` varchar(50) default NULL, -- the mobile phone number where the patron/borrower would like to receive notices (if SNS turned on) `privacy` integer(11) DEFAULT '1' NOT NULL, -- patron/borrower's privacy settings related to their reading history + `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, -- time of last change could be useful for synchronization with external systems (among others) UNIQUE KEY `cardnumber` (`cardnumber`), PRIMARY KEY `borrowernumber` (`borrowernumber`), KEY `categorycode` (`categorycode`),