Bug 24289: DBRev 19.11.02.003
Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
This commit is contained in:
parent
d950985d17
commit
269bbbf2b6
2
Koha.pm
2
Koha.pm
|
|
@ -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 = "19.11.02.002";
|
||||
$VERSION = "19.11.02.003";
|
||||
|
||||
sub version {
|
||||
return $VERSION;
|
||||
|
|
|
|||
|
|
@ -631,6 +631,21 @@ __PACKAGE__->has_many(
|
|||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 repeatable_holidays
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Koha::Schema::Result::RepeatableHoliday>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"repeatable_holidays",
|
||||
"Koha::Schema::Result::RepeatableHoliday",
|
||||
{ "foreign.branchcode" => "self.branchcode" },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 reserves
|
||||
|
||||
Type: has_many
|
||||
|
|
@ -646,6 +661,21 @@ __PACKAGE__->has_many(
|
|||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 special_holidays
|
||||
|
||||
Type: has_many
|
||||
|
||||
Related object: L<Koha::Schema::Result::SpecialHoliday>
|
||||
|
||||
=cut
|
||||
|
||||
__PACKAGE__->has_many(
|
||||
"special_holidays",
|
||||
"Koha::Schema::Result::SpecialHoliday",
|
||||
{ "foreign.branchcode" => "self.branchcode" },
|
||||
{ cascade_copy => 0, cascade_delete => 0 },
|
||||
);
|
||||
|
||||
=head2 stockrotationstages
|
||||
|
||||
Type: has_many
|
||||
|
|
@ -707,8 +737,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-10-14 09:59:52
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:vWDJAm3K2jiyRS3htyip6A
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2020-02-07 23:10:36
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8MMgxmWm5R7gR6DCh7DftQ
|
||||
|
||||
__PACKAGE__->add_columns(
|
||||
'+pickup_location' => { is_boolean => 1 }
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ __PACKAGE__->table("repeatable_holidays");
|
|||
=head2 branchcode
|
||||
|
||||
data_type: 'varchar'
|
||||
default_value: (empty string)
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
size: 10
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ __PACKAGE__->add_columns(
|
|||
"id",
|
||||
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
|
||||
"branchcode",
|
||||
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
|
||||
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
|
||||
"weekday",
|
||||
{ data_type => "smallint", is_nullable => 1 },
|
||||
"day",
|
||||
|
|
@ -94,9 +94,26 @@ __PACKAGE__->add_columns(
|
|||
|
||||
__PACKAGE__->set_primary_key("id");
|
||||
|
||||
=head1 RELATIONS
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tp+p/e8mXWJv33yYXNMoww
|
||||
=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.07046 @ 2020-02-07 23:10:36
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/WSWuhjk3b3PlmtuMSygWw
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ __PACKAGE__->table("special_holidays");
|
|||
=head2 branchcode
|
||||
|
||||
data_type: 'varchar'
|
||||
default_value: (empty string)
|
||||
is_foreign_key: 1
|
||||
is_nullable: 0
|
||||
size: 10
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ __PACKAGE__->add_columns(
|
|||
"id",
|
||||
{ data_type => "integer", is_auto_increment => 1, is_nullable => 0 },
|
||||
"branchcode",
|
||||
{ data_type => "varchar", default_value => "", is_nullable => 0, size => 10 },
|
||||
{ data_type => "varchar", is_foreign_key => 1, is_nullable => 0, size => 10 },
|
||||
"day",
|
||||
{ data_type => "smallint", default_value => 0, is_nullable => 0 },
|
||||
"month",
|
||||
|
|
@ -105,9 +105,26 @@ __PACKAGE__->add_columns(
|
|||
|
||||
__PACKAGE__->set_primary_key("id");
|
||||
|
||||
=head1 RELATIONS
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:54
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9Qc6VbOUqX83upThUC//oA
|
||||
=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.07046 @ 2020-02-07 23:10:36
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ew9HTbXixBeTRsJe4b4l/g
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
|||
|
|
@ -20297,6 +20297,39 @@ if( CheckVersion( $DBversion ) ) {
|
|||
print "Upgrade to $DBversion done (Bug 24338 - Add 'CASH' to default 'PAYMENT_TYPE')\n";
|
||||
}
|
||||
|
||||
$DBversion = '19.11.02.003';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
if( !foreign_key_exists( 'repeatable_holidays', 'repeatable_holidays_ibfk_1' ) ) {
|
||||
$dbh->do(q|
|
||||
DELETE h
|
||||
FROM repeatable_holidays h
|
||||
LEFT JOIN branches b ON h.branchcode=b.branchcode
|
||||
WHERE b.branchcode IS NULL;
|
||||
|);
|
||||
$dbh->do(q|
|
||||
ALTER TABLE repeatable_holidays
|
||||
ADD FOREIGN KEY repeatable_holidays_ibfk_1 (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
|);
|
||||
}
|
||||
|
||||
if( !foreign_key_exists( 'special_holidays', 'special_holidays_ibfk_1' ) ) {
|
||||
$dbh->do(q|
|
||||
DELETE h
|
||||
FROM special_holidays h
|
||||
LEFT JOIN branches b ON h.branchcode=b.branchcode
|
||||
WHERE b.branchcode IS NULL;
|
||||
|);
|
||||
$dbh->do(q|
|
||||
ALTER TABLE special_holidays
|
||||
ADD FOREIGN KEY special_holidays_ibfk_1 (branchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
|
||||
|);
|
||||
}
|
||||
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 24289 - Adding foreign keys on *_holidays.branchcode tables)\n";
|
||||
}
|
||||
|
||||
|
||||
# SEE bug 13068
|
||||
# if there is anything in the atomicupdate, read and execute it.
|
||||
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';
|
||||
|
|
|
|||
Loading…
Reference in New Issue