[Koha-patches] [PATCH 2/4] Bug 6328 Followup--update DB structure
Katrin Fischer
Katrin.Fischer.83 at web.de
Tue May 17 21:05:58 CEST 2011
From: Frédéric Demians <f.demians at tamil.fr>
Thanks Katrin.
Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
---
installer/data/mysql/kohastructure.sql | 6 ++++--
installer/data/mysql/updatedatabase.pl | 4 +++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql
index e3c6f42..37ad2d8 100644
--- a/installer/data/mysql/kohastructure.sql
+++ b/installer/data/mysql/kohastructure.sql
@@ -232,7 +232,8 @@ CREATE TABLE `borrowers` (
`dateexpiry` date default NULL,
`gonenoaddress` tinyint(1) default NULL,
`lost` tinyint(1) default NULL,
- `debarred` tinyint(1) default NULL,
+ `debarred` date default NULL,
+ `debarredcomment` VARCHAR(255) DEFAULT NULL,
`contactname` mediumtext,
`contactfirstname` text,
`contacttitle` text,
@@ -684,7 +685,8 @@ CREATE TABLE `deletedborrowers` (
`dateexpiry` date default NULL,
`gonenoaddress` tinyint(1) default NULL,
`lost` tinyint(1) default NULL,
- `debarred` tinyint(1) default NULL,
+ `debarred` date default NULL,
+ `debarredcomment` VARCHAR(255) DEFAULT NULL,
`contactname` mediumtext,
`contactfirstname` text,
`contacttitle` text,
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index ab8ac9a..719c3a5 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -4332,12 +4332,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
SetVersion($DBversion);
}
-$DBversion = "3.05.00.002";
+$DBversion = "3.05.00.XXX";
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
my $borrowers = $dbh->selectcol_arrayref( "SELECT borrowernumber from borrowers where debarred <>0;", { Columns => [1] } );
$dbh->do("ALTER TABLE borrowers MODIFY debarred DATE DEFAULT NULL;");
$dbh->do( "UPDATE borrowers set debarred='9999-12-31' where borrowernumber IN (" . join( ",", @$borrowers ) . ");" ) if ($borrowers and scalar(@$borrowers)>0);
$dbh->do("ALTER TABLE borrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;");
+ $dbh->do("ALTER TABLE deletedborrowers MODIFY debarred DATE DEFAULT NULL;");
+ $dbh->do("ALTER TABLE deletedborrowers ADD COLUMN debarredcomment VARCHAR(255) DEFAULT NULL AFTER debarred;");
print "Upgrade done (Change borrowers.debarred into Date )\n";
SetVersion($DBversion);
--
1.7.4.1
More information about the Koha-patches
mailing list