Bug 11529: DBRev 19.06.00.018
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
66655602b7
commit
7883eb0692
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.06.00.017";
|
||||
$VERSION = "19.06.00.018";
|
||||
|
||||
sub version {
|
||||
return $VERSION;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ __PACKAGE__->table("biblio");
|
|||
|
||||
data_type: 'timestamp'
|
||||
datetime_undef_if_invalid: 1
|
||||
default_value: 'current_timestamp()'
|
||||
default_value: current_timestamp
|
||||
is_nullable: 0
|
||||
|
||||
=head2 datecreated
|
||||
|
|
@ -142,7 +142,7 @@ __PACKAGE__->add_columns(
|
|||
{
|
||||
data_type => "timestamp",
|
||||
datetime_undef_if_invalid => 1,
|
||||
default_value => "current_timestamp()",
|
||||
default_value => \"current_timestamp",
|
||||
is_nullable => 0,
|
||||
},
|
||||
"datecreated",
|
||||
|
|
@ -391,8 +391,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07049 @ 2019-03-15 16:45:45
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:61+Di/Fke60nCaASGeXbvw
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-08-05 13:53:34
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:AzvuQItPPs5WeC4tdtS/NQ
|
||||
|
||||
|
||||
__PACKAGE__->has_one(
|
||||
|
|
|
|||
|
|
@ -46,6 +46,26 @@ __PACKAGE__->table("deletedbiblio");
|
|||
data_type: 'longtext'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 medium
|
||||
|
||||
data_type: 'longtext'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 subtitle
|
||||
|
||||
data_type: 'longtext'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 part_number
|
||||
|
||||
data_type: 'longtext'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 part_name
|
||||
|
||||
data_type: 'longtext'
|
||||
is_nullable: 1
|
||||
|
||||
=head2 unititle
|
||||
|
||||
data_type: 'longtext'
|
||||
|
|
@ -100,6 +120,14 @@ __PACKAGE__->add_columns(
|
|||
{ data_type => "longtext", is_nullable => 1 },
|
||||
"title",
|
||||
{ data_type => "longtext", is_nullable => 1 },
|
||||
"medium",
|
||||
{ data_type => "longtext", is_nullable => 1 },
|
||||
"subtitle",
|
||||
{ data_type => "longtext", is_nullable => 1 },
|
||||
"part_number",
|
||||
{ data_type => "longtext", is_nullable => 1 },
|
||||
"part_name",
|
||||
{ data_type => "longtext", is_nullable => 1 },
|
||||
"unititle",
|
||||
{ data_type => "longtext", is_nullable => 1 },
|
||||
"notes",
|
||||
|
|
@ -153,8 +181,8 @@ __PACKAGE__->has_many(
|
|||
);
|
||||
|
||||
|
||||
# Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-02-16 17:54:53
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:dP0HOIp/+I93Y/u92TDI1g
|
||||
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-08-05 13:53:34
|
||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:FQaznWmkfR2Ge5NG8lDmSw
|
||||
|
||||
|
||||
# You can replace this text with custom content, and it will be preserved on regeneration
|
||||
|
|
|
|||
|
|
@ -1,75 +0,0 @@
|
|||
$DBversion = 'XXX'; # will be replaced by the RM
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
if( !column_exists( 'biblio', 'subtitle' ) ) {
|
||||
$dbh->do( "ALTER TABLE biblio ADD COLUMN medium LONGTEXT AFTER title" );
|
||||
$dbh->do( "ALTER TABLE biblio ADD COLUMN subtitle LONGTEXT AFTER medium" );
|
||||
$dbh->do( "ALTER TABLE biblio ADD COLUMN part_number LONGTEXT AFTER subtitle" );
|
||||
$dbh->do( "ALTER TABLE biblio ADD COLUMN part_name LONGTEXT AFTER part_number" );
|
||||
|
||||
$dbh->do( "ALTER TABLE deletedbiblio ADD COLUMN medium LONGTEXT AFTER title" );
|
||||
$dbh->do( "ALTER TABLE deletedbiblio ADD COLUMN subtitle LONGTEXT AFTER medium" );
|
||||
$dbh->do( "ALTER TABLE deletedbiblio ADD COLUMN part_number LONGTEXT AFTER subtitle" );
|
||||
$dbh->do( "ALTER TABLE deletedbiblio ADD COLUMN part_name LONGTEXT AFTER part_number" );
|
||||
}
|
||||
|
||||
$dbh->do( "UPDATE marc_subfield_structure SET kohafield='biblio.subtitle' WHERE kohafield='bibliosubtitle.subtitle'" );
|
||||
|
||||
my $marcflavour = C4::Context->preference('marcflavour');
|
||||
|
||||
if ( $marcflavour eq 'UNIMARC' ) {
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.medium'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='200' AND tagsubfield='b'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.subtitle'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='200' AND tagsubfield='e'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.part_number'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='200' AND tagsubfield='h'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.part_name'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='200' AND tagsubfield='i'
|
||||
});
|
||||
} else {
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.medium'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='245' AND tagsubfield='h'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.subtitle'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='245' AND tagsubfield='b'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.part_number'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='245' AND tagsubfield='n'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.part_name'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='245' AND tagsubfield='p'
|
||||
});
|
||||
}
|
||||
|
||||
$dbh->do("UPDATE marc_subfield_structure JOIN fieldmapping ON tagfield = fieldcode AND subfieldcode=tagsubfield SET kohafield='biblio.subtitle' WHERE fieldmapping.frameworkcode=''");
|
||||
$sth = $dbh->prepare("SELECT * FROM fieldmapping WHERE frameworkcode != '' OR field != 'subtitle'");
|
||||
$sth->execute;
|
||||
print "Keyword to MARC mappings below cannot be preserved: \n" if $sth->rows;
|
||||
while ( my $value = $sth->fetchrow_hashref() ){
|
||||
my $framework = $value->{frameworkcode} eq "" ? "Default" : $value->{frameworkcode};
|
||||
print " keyword: " . $value->{'field'} . " to field: " . $value->{fieldcode} . "\$" . $value->{subfieldcode} . " for $framework framework\n";
|
||||
}
|
||||
print "You will need to remap using Koha to MARC mappings in administration\n" if $sth->rows;
|
||||
|
||||
|
||||
# $dbh->do( "DROP TABLE IF EXISTS fieldmapping" );
|
||||
|
||||
$dbh->do( "DELETE FROM user_permissions WHERE code='manage_keywords2koha_mappings'" );
|
||||
|
||||
$dbh->do( "DELETE FROM permissions WHERE code='manage_keywords2koha_mappings'" );
|
||||
|
||||
# Always end with this (adjust the bug info)
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 11529 - Add medium, subtitle and part information to biblio table)\n";
|
||||
}
|
||||
|
|
@ -19144,6 +19144,82 @@ if ( CheckVersion($DBversion) ) {
|
|||
print "Upgrade to $DBversion done (Bug 22610 - Fix accounttypes for SIP2 payments)\n";
|
||||
}
|
||||
|
||||
$DBversion = '19.06.00.018';
|
||||
if( CheckVersion( $DBversion ) ) {
|
||||
if( !column_exists( 'biblio', 'subtitle' ) ) {
|
||||
$dbh->do( "ALTER TABLE biblio ADD COLUMN medium LONGTEXT AFTER title" );
|
||||
$dbh->do( "ALTER TABLE biblio ADD COLUMN subtitle LONGTEXT AFTER medium" );
|
||||
$dbh->do( "ALTER TABLE biblio ADD COLUMN part_number LONGTEXT AFTER subtitle" );
|
||||
$dbh->do( "ALTER TABLE biblio ADD COLUMN part_name LONGTEXT AFTER part_number" );
|
||||
|
||||
$dbh->do( "ALTER TABLE deletedbiblio ADD COLUMN medium LONGTEXT AFTER title" );
|
||||
$dbh->do( "ALTER TABLE deletedbiblio ADD COLUMN subtitle LONGTEXT AFTER medium" );
|
||||
$dbh->do( "ALTER TABLE deletedbiblio ADD COLUMN part_number LONGTEXT AFTER subtitle" );
|
||||
$dbh->do( "ALTER TABLE deletedbiblio ADD COLUMN part_name LONGTEXT AFTER part_number" );
|
||||
}
|
||||
|
||||
$dbh->do( "UPDATE marc_subfield_structure SET kohafield='biblio.subtitle' WHERE kohafield='bibliosubtitle.subtitle'" );
|
||||
|
||||
my $marcflavour = C4::Context->preference('marcflavour');
|
||||
|
||||
if ( $marcflavour eq 'UNIMARC' ) {
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.medium'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='200' AND tagsubfield='b'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.subtitle'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='200' AND tagsubfield='e'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.part_number'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='200' AND tagsubfield='h'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.part_name'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='200' AND tagsubfield='i'
|
||||
});
|
||||
} else {
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.medium'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='245' AND tagsubfield='h'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.subtitle'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='245' AND tagsubfield='b'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.part_number'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='245' AND tagsubfield='n'
|
||||
});
|
||||
$dbh->do(qq{
|
||||
UPDATE marc_subfield_structure SET kohafield='biblio.part_name'
|
||||
WHERE (kohafield IS NULL OR kohafield='') AND frameworkcode='' AND tagfield='245' AND tagsubfield='p'
|
||||
});
|
||||
}
|
||||
|
||||
$dbh->do("UPDATE marc_subfield_structure JOIN fieldmapping ON tagfield = fieldcode AND subfieldcode=tagsubfield SET kohafield='biblio.subtitle' WHERE fieldmapping.frameworkcode=''");
|
||||
$sth = $dbh->prepare("SELECT * FROM fieldmapping WHERE frameworkcode != '' OR field != 'subtitle'");
|
||||
$sth->execute;
|
||||
print "Keyword to MARC mappings below cannot be preserved: \n" if $sth->rows;
|
||||
while ( my $value = $sth->fetchrow_hashref() ){
|
||||
my $framework = $value->{frameworkcode} eq "" ? "Default" : $value->{frameworkcode};
|
||||
print " keyword: " . $value->{'field'} . " to field: " . $value->{fieldcode} . "\$" . $value->{subfieldcode} . " for $framework framework\n";
|
||||
}
|
||||
print "You will need to remap using Koha to MARC mappings in administration\n" if $sth->rows;
|
||||
|
||||
|
||||
$dbh->do( "DROP TABLE IF EXISTS fieldmapping" );
|
||||
|
||||
$dbh->do( "DELETE FROM user_permissions WHERE code='manage_keywords2koha_mappings'" );
|
||||
|
||||
$dbh->do( "DELETE FROM permissions WHERE code='manage_keywords2koha_mappings'" );
|
||||
|
||||
# Always end with this (adjust the bug info)
|
||||
SetVersion( $DBversion );
|
||||
print "Upgrade to $DBversion done (Bug 11529 - Add medium, subtitle and part information to biblio table)\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