Browse Source

Bug 14237: DBRev 21.06.00.006

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11.x
Jonathan Druart 6 months ago
parent
commit
d9ef08365f
  1. 2
      Koha.pm
  2. 20
      installer/data/mysql/atomicupdate/bug_14237-add_course_items.biblionumber_column.perl
  3. 21
      installer/data/mysql/updatedatabase.pl

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 = "21.06.00.005";
$VERSION = "21.06.00.006";
sub version {
return $VERSION;

20
installer/data/mysql/atomicupdate/bug_14237-add_course_items.biblionumber_column.perl

@ -1,20 +0,0 @@
$DBversion = 'XXX';
if( CheckVersion( $DBversion ) ){
unless( column_exists( 'course_items', 'biblionumber') ) {
$dbh->do(q{ ALTER TABLE course_items ADD `biblionumber` int(11) AFTER `itemnumber` });
$dbh->do(q{
UPDATE course_items
LEFT JOIN items ON items.itemnumber=course_items.itemnumber
SET course_items.biblionumber=items.biblionumber
WHERE items.itemnumber IS NOT NULL
});
$dbh->do(q{ ALTER TABLE course_items MODIFY COLUMN `biblionumber` INT(11) NOT NULL });
$dbh->do(q{ ALTER TABLE course_items ADD CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE });
$dbh->do(q{ ALTER TABLE course_items CHANGE `itemnumber` `itemnumber` int(11) DEFAULT NULL });
}
NewVersion( $DBversion, 14237, ["Add course_items.biblionumber column", "Add fk_course_items_biblionumber constraint", "Change course_items.itemnumber to allow NULL values"] );
}

21
installer/data/mysql/updatedatabase.pl

@ -24373,6 +24373,27 @@ if( CheckVersion( $DBversion ) ) {
NewVersion( $DBversion, 26205, "Add new system preference NewsLog to log news changes");
}
$DBversion = '21.06.00.006';
if( CheckVersion( $DBversion ) ){
unless( column_exists( 'course_items', 'biblionumber') ) {
$dbh->do(q{ ALTER TABLE course_items ADD `biblionumber` int(11) AFTER `itemnumber` });
$dbh->do(q{
UPDATE course_items
LEFT JOIN items ON items.itemnumber=course_items.itemnumber
SET course_items.biblionumber=items.biblionumber
WHERE items.itemnumber IS NOT NULL
});
$dbh->do(q{ ALTER TABLE course_items MODIFY COLUMN `biblionumber` INT(11) NOT NULL });
$dbh->do(q{ ALTER TABLE course_items ADD CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE });
$dbh->do(q{ ALTER TABLE course_items CHANGE `itemnumber` `itemnumber` int(11) DEFAULT NULL });
}
NewVersion( $DBversion, 14237, ["Add course_items.biblionumber column", "Add fk_course_items_biblionumber constraint", "Change course_items.itemnumber to allow NULL values"] );
}
# 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…
Cancel
Save