Bug 24476: Database updates

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Nick Clemens 2020-01-23 02:35:38 +00:00 committed by Martin Renvoize
parent f6028a3d34
commit 012af329ab
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,21 @@
$DBversion = 'XXX';
if( CheckVersion( $DBversion ) ) {
unless( column_exists('borrowers','autorenewal') ){
$dbh->do( "ALTER TABLE borrowers ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
}
unless( column_exists('deletedborrowers','autorenewal') ){
$dbh->do( "ALTER TABLE deletedborrowers ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
}
unless( column_exists('borrower_modifications','autorenewal') ){
$dbh->do( "ALTER TABLE borrower_modifications ADD COLUMN autorenewal TINYINT(1) NOT NULL DEFAULT 1" );
}
$dbh->do(q{
UPDATE systempreferences
SET value = CONCAT(value,'|autorenewal')
WHERE variable IN
('PatronSelfModificationBorrowerUnwantedField','PatronSelfRegistrationBorrowerUnwantedField')
AND value NOT LIKE '%autorenewal%'
});
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 24476 - Allow patrons to opt-out of autorenewal)\n";
}

View File

@ -589,6 +589,7 @@ CREATE TABLE `deletedborrowers` ( -- stores data related to the patrons/borrower
`login_attempts` int(4) default 0, -- number of failed login attemps
`overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
`anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
`autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
KEY borrowernumber (borrowernumber),
KEY `cardnumber` (`cardnumber`),
KEY `sms_provider_id` (`sms_provider_id`)
@ -1532,6 +1533,7 @@ CREATE TABLE `borrowers` ( -- this table includes information about your patrons
`login_attempts` int(4) default 0, -- number of failed login attemps
`overdrive_auth_token` MEDIUMTEXT default NULL, -- persist OverDrive auth token
`anonymized` TINYINT(1) NOT NULL DEFAULT 0, -- flag for data anonymization
`autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
UNIQUE KEY `cardnumber` (`cardnumber`),
PRIMARY KEY `borrowernumber` (`borrowernumber`),
KEY `categorycode` (`categorycode`),
@ -3439,6 +3441,7 @@ CREATE TABLE IF NOT EXISTS `borrower_modifications` (
`privacy` int(11) DEFAULT NULL,
`extended_attributes` MEDIUMTEXT DEFAULT NULL,
`gdpr_proc_consent` datetime, -- data processing consent
`autorenewal` TINYINT(1) NOT NULL DEFAULT 1, -- flag for allowing auto-renewal
PRIMARY KEY (`verification_token` (191),`borrowernumber`),
KEY `verification_token` (`verification_token` (191)),
KEY `borrowernumber` (`borrowernumber`)