1 $DBversion = 'XXX'; # will be replaced by the RM
2 if( CheckVersion( $DBversion ) ) {
3 # you can use $dbh here like:
4 # $dbh->do( "ALTER TABLE biblio ADD COLUMN badtaste int" );
6 # or perform some test and warn
7 if( !TableExists( 'import_batch_profiles' ) ) {
9 CREATE TABLE `import_batch_profiles` ( -- profile for batches of marc records to be imported
10 `id` int(11) NOT NULL auto_increment, -- unique identifier and primary key
11 `name` varchar(100) NOT NULL, -- name of this profile
12 `matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id)
13 `template_id` int(11) default NULL, -- the id of the marc modification template
14 `overlay_action` varchar(50) default NULL, -- how to handle duplicate records
15 `nomatch_action` varchar(50) default NULL, -- how to handle records where no match is found
16 `item_action` varchar(50) default NULL, -- what to do with item records
17 `parse_items` tinyint(1) default NULL, -- should items be parsed
18 `record_type` varchar(50) default NULL, -- type of record in the batch
19 `encoding` varchar(50) default NULL, -- file encoding
20 `format` varchar(50) default NULL, -- marc format
21 `comments` LONGTEXT, -- any comments added when the file was uploaded
23 UNIQUE KEY `u_import_batch_profiles__name` (`name`)
24 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
28 if(!column_exists('import_batches', 'profile_id')) {
30 ALTER TABLE import_batches ADD COLUMN `profile_id` int(11) default NULL AFTER comments
34 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
38 # Always end with this (adjust the bug info)
39 NewVersion( $DBversion, 23019, "Add import_batch_profiles table and profile_id column in import_batches");