Bug 21082: Database updates
[koha.git] / installer / data / mysql / atomicupdate / bug_21082-add_option_for_overdrive_patron_auth.perl
1 $DBversion = 'XXX';  # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
3     $dbh->do('DROP TABLE IF EXISTS branches_overdrive');
4     $dbh->do( q|
5         CREATE TABLE IF NOT EXISTS branches_overdrive (
6             `branchcode` VARCHAR( 10 ) NOT NULL ,
7             `authname` VARCHAR( 255 ) NOT NULL ,
8             PRIMARY KEY (`branchcode`) ,
9             CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
10         ) ENGINE = INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |);
11     $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveAuthname', '', 'Authname for OverDrive Patron Authentication, will be used as fallback if individual branch authname not set', NULL, 'Free');");
12     $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveWebsiteID','', 'WebsiteID provided by OverDrive', NULL, 'Free');");
13     $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDrivePasswordRequired','', 'Does the library require passwords for OverDrive SIP authentication', NULL, 'YesNo');");
14     SetVersion( $DBversion );
15     print "Upgrade to $DBversion done (Bug 21082 - Add overdrive patron auth method)\n";
16 }