Bug 21082: DBRev 18.06.00.037

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Nick Clemens 2018-10-09 10:41:03 +00:00
parent e762bdb9b2
commit 91790fdd90
5 changed files with 120 additions and 19 deletions

View File

@ -29,7 +29,7 @@ use vars qw{ $VERSION };
# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
$VERSION = "18.06.00.036";
$VERSION = "18.06.00.037";
sub version {
return $VERSION;

View File

@ -316,6 +316,21 @@ __PACKAGE__->has_many(
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 branches_overdrive
Type: might_have
Related object: L<Koha::Schema::Result::BranchesOverdrive>
=cut
__PACKAGE__->might_have(
"branches_overdrive",
"Koha::Schema::Result::BranchesOverdrive",
{ "foreign.branchcode" => "self.branchcode" },
{ cascade_copy => 0, cascade_delete => 0 },
);
=head2 branchtransfers_frombranches
Type: has_many
@ -632,8 +647,8 @@ __PACKAGE__->has_many(
);
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-05 14:29:17
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:L/zUeW5lNf5oJcZ/bES7rw
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-09 10:38:33
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nKWRDScCAwZUDrRhm1kYMA
# You can replace this text with custom code or comments, and it will be preserved on regeneration

View File

@ -0,0 +1,83 @@
use utf8;
package Koha::Schema::Result::BranchesOverdrive;
# Created by DBIx::Class::Schema::Loader
# DO NOT MODIFY THE FIRST PART OF THIS FILE
=head1 NAME
Koha::Schema::Result::BranchesOverdrive
=cut
use strict;
use warnings;
use base 'DBIx::Class::Core';
=head1 TABLE: C<branches_overdrive>
=cut
__PACKAGE__->table("branches_overdrive");
=head1 ACCESSORS
=head2 branchcode
data_type: 'varchar'
is_foreign_key: 1
is_nullable: 0
size: 10
=head2 authname
data_type: 'varchar'
is_nullable: 0
size: 255
=cut
__PACKAGE__->add_columns(
"branchcode",
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
"authname",
{ data_type => "varchar", is_nullable => 0, size => 255 },
);
=head1 PRIMARY KEY
=over 4
=item * L</branchcode>
=back
=cut
__PACKAGE__->set_primary_key("branchcode");
=head1 RELATIONS
=head2 branchcode
Type: belongs_to
Related object: L<Koha::Schema::Result::Branch>
=cut
__PACKAGE__->belongs_to(
"branchcode",
"Koha::Schema::Result::Branch",
{ branchcode => "branchcode" },
{ is_deferrable => 1, on_delete => "CASCADE", on_update => "CASCADE" },
);
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-10-09 10:38:33
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:fEZWWtF4MRDwupI/27laDw
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;

View File

@ -1,16 +0,0 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
$dbh->do('DROP TABLE IF EXISTS branches_overdrive');
$dbh->do( q|
CREATE TABLE IF NOT EXISTS branches_overdrive (
`branchcode` VARCHAR( 10 ) NOT NULL ,
`authname` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY (`branchcode`) ,
CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |);
$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');");
$dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveWebsiteID','', 'WebsiteID provided by OverDrive', NULL, 'Free');");
$dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDrivePasswordRequired','', 'Does the library require passwords for OverDrive SIP authentication', NULL, 'YesNo');");
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 21082 - Add overdrive patron auth method)\n";
}

View File

@ -16526,6 +16526,25 @@ if( CheckVersion( $DBversion ) ) {
print "Upgrade to $DBversion done (Bug 18887 - Introduce new table 'circulation_rules', use for 'max_holds' rules)\n";
}
$DBversion = '18.06.00.037';
if( CheckVersion( $DBversion ) ) {
unless (TableExists('branches_overdrive')){
$dbh->do( q|
CREATE TABLE IF NOT EXISTS branches_overdrive (
`branchcode` VARCHAR( 10 ) NOT NULL ,
`authname` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY (`branchcode`) ,
CONSTRAINT `branches_overdrive_ibfk_1` FOREIGN KEY (`branchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci |
);
}
$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');");
$dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDriveWebsiteID','', 'WebsiteID provided by OverDrive', NULL, 'Free');");
$dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('OverDrivePasswordRequired','', 'Does the library require passwords for OverDrive SIP authentication', NULL, 'YesNo');");
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 21082 - Add overdrive patron auth method)\n";
}
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.