Browse Source

Bug 23019: DBRev 20.06.00.068

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Jonathan Druart 1 year ago
parent
commit
6adc4514c6
  1. 2
      Koha.pm
  2. 40
      installer/data/mysql/atomicupdate/bug-23019.perl
  3. 36
      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 = "20.06.00.067";
$VERSION = "20.06.00.068";
sub version {
return $VERSION;

40
installer/data/mysql/atomicupdate/bug-23019.perl

@ -1,40 +0,0 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
# you can use $dbh here like:
# $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" );
# or perform some test and warn
if( !TableExists( 'import_batch_profiles' ) ) {
$dbh->do(q{
CREATE TABLE `import_batch_profiles` ( -- profile for batches of marc records to be imported
`id` int(11) NOT NULL auto_increment, -- unique identifier and primary key
`name` varchar(100) NOT NULL, -- name of this profile
`matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id)
`template_id` int(11) default NULL, -- the id of the marc modification template
`overlay_action` varchar(50) default NULL, -- how to handle duplicate records
`nomatch_action` varchar(50) default NULL, -- how to handle records where no match is found
`item_action` varchar(50) default NULL, -- what to do with item records
`parse_items` tinyint(1) default NULL, -- should items be parsed
`record_type` varchar(50) default NULL, -- type of record in the batch
`encoding` varchar(50) default NULL, -- file encoding
`format` varchar(50) default NULL, -- marc format
`comments` LONGTEXT, -- any comments added when the file was uploaded
PRIMARY KEY (`id`),
UNIQUE KEY `u_import_batch_profiles__name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
});
}
if(!column_exists('import_batches', 'profile_id')) {
$dbh->do(q{
ALTER TABLE import_batches ADD COLUMN `profile_id` int(11) default NULL AFTER comments
});
$dbh->do(q{
ALTER TABLE import_batches ADD CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
});
}
# Always end with this (adjust the bug info)
NewVersion( $DBversion, 23019, "Add import_batch_profiles table and profile_id column in import_batches");
}

36
installer/data/mysql/updatedatabase.pl

@ -23350,6 +23350,42 @@ if( CheckVersion( $DBversion ) ) {
NewVersion( $DBversion, 20936, "Add new system preference OPACHoldsHistory");
}
$DBversion = '20.06.00.068';
if( CheckVersion( $DBversion ) ) {
if( !TableExists( 'import_batch_profiles' ) ) {
$dbh->do(q{
CREATE TABLE `import_batch_profiles` ( -- profile for batches of marc records to be imported
`id` int(11) NOT NULL auto_increment, -- unique identifier and primary key
`name` varchar(100) NOT NULL, -- name of this profile
`matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id)
`template_id` int(11) default NULL, -- the id of the marc modification template
`overlay_action` varchar(50) default NULL, -- how to handle duplicate records
`nomatch_action` varchar(50) default NULL, -- how to handle records where no match is found
`item_action` varchar(50) default NULL, -- what to do with item records
`parse_items` tinyint(1) default NULL, -- should items be parsed
`record_type` varchar(50) default NULL, -- type of record in the batch
`encoding` varchar(50) default NULL, -- file encoding
`format` varchar(50) default NULL, -- marc format
`comments` LONGTEXT, -- any comments added when the file was uploaded
PRIMARY KEY (`id`),
UNIQUE KEY `u_import_batch_profiles__name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
});
}
if(!column_exists('import_batches', 'profile_id')) {
$dbh->do(q{
ALTER TABLE import_batches ADD COLUMN `profile_id` int(11) default NULL AFTER comments
});
$dbh->do(q{
ALTER TABLE import_batches ADD CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) REFERENCES `import_batch_profiles` (`id`) ON DELETE SET NULL ON UPDATE SET NULL
});
}
NewVersion( $DBversion, 23019, "Add import_batch_profiles table and profile_id column in import_batches" );
}
# 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