Bug 20819: Db rev for new table patron_consent and sysprefs
[koha.git] / installer / data / mysql / atomicupdate / bug_20819.perl
1 $DBversion = 'XXX';  # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
3
4     # Add table and add column
5     $dbh->do(q|
6 CREATE TABLE patron_consent (id int AUTO_INCREMENT, borrowernumber int NOT NULL, type enum('GDPR_PROCESSING' ), given_on datetime, refused_on datetime, PRIMARY KEY (id), FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE )
7     |);
8     $dbh->do(q|
9 ALTER TABLE borrower_modifications ADD COLUMN gdpr_proc_consent datetime
10     |);
11
12     # Add two sysprefs too
13     $dbh->do(q|
14 INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ('PrivacyPolicyURL','',NULL,'This URL is used in messages about GDPR consents.', 'Free')
15     |);
16     $dbh->do(q|
17 INSERT IGNORE INTO systempreferences ( variable, value, options, explanation, type ) VALUES ('GDPR_Policy','','Enforced\|Permissive\|Disabled','General Data Protection Regulation - policy', 'Choice')
18     |);
19
20     SetVersion( $DBversion );
21     print "Upgrade to $DBversion done (Bug 20819: Add patron_consent)\n";
22 }