From d9da8093bb03b8d44f46bf6558924d48a046392b Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Mon, 17 Mar 2008 10:43:58 -0400 Subject: [PATCH] Eighth installment Patron card generation feature Signed-off-by: Joshua Ferraro --- installer/data/mysql/kohastructure.sql | 15 +++++++++++++++ installer/data/mysql/updatedatabase.pl | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 81e07f3355..b7d01de227 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1451,6 +1451,21 @@ CREATE TABLE `overduerules` ( PRIMARY KEY (`branchcode`,`categorycode`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +-- +-- Table structure for table `patroncards` +-- + +DROP TABLE IF EXISTS `patroncards`; +Create Table: CREATE TABLE `patroncards` ( + `cardid` int(11) NOT NULL auto_increment, + `batch_id` varchar(10) NOT NULL default '1', + `borrowernumber` int(11) NOT NULL, + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`cardid`), + KEY `patroncards_ibfk_1` (`borrowernumber`), + CONSTRAINT `patroncards_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8 + -- -- Table structure for table `patronimage` -- diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a66e2db62a..0e2a6909e0 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -1198,6 +1198,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { print "Upgrade to $DBversion done (IMPORTANT: Upgrading to Amazon.com Associates Web Service 4.0 ) "; SetVersion ($DBversion); } + +$DBversion = "3.00.00.065"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("Create Table: CREATE TABLE `patroncards` ( + `cardid` int(11) NOT NULL auto_increment, + `batch_id` varchar(10) NOT NULL default '1', + `borrowernumber` int(11) NOT NULL, + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, + PRIMARY KEY (`cardid`), + KEY `patroncards_ibfk_1` (`borrowernumber`), + CONSTRAINT `patroncards_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + print "Upgrade to $DBversion done (Adding patroncards table for patroncards generation feature. ) "; + SetVersion ($DBversion); +} + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table -- 2.39.5