Bugzilla – Attachment 104972 Details for
Bug 23019
Ability to create 'matching profiles' when importing records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23019: Update database structure and add atomic update
Bug-23019-Update-database-structure-and-add-atomic.patch (text/plain), 5.07 KB, created by
Agustín Moyano
on 2020-05-15 22:01:31 UTC
(
hide
)
Description:
Bug 23019: Update database structure and add atomic update
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2020-05-15 22:01:31 UTC
Size:
5.07 KB
patch
obsolete
>From f51f81f10a6adfeed226693a2706ce66fd355550 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Fri, 15 May 2020 11:09:53 -0300 >Subject: [PATCH] Bug 23019: Update database structure and add atomic update > >--- > .../data/mysql/atomicupdate/bug-23019.perl | 39 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 26 ++++++++++++- > 2 files changed, 64 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug-23019.perl > >diff --git a/installer/data/mysql/atomicupdate/bug-23019.perl b/installer/data/mysql/atomicupdate/bug-23019.perl >new file mode 100644 >index 0000000000..7c87d8295a >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug-23019.perl >@@ -0,0 +1,39 @@ >+$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_batches_profile' ) ) { >+ $dbh->do(q{ >+ CREATE TABLE `import_batches_profile` ( -- profile for batches of marc records to be imported >+ `profile_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 (`profile_id`) >+ ) 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_batches_profile` (`profile_id`) ON DELETE SET NULL ON UPDATE SET NULL >+ }); >+ } >+ >+ # Always end with this (adjust the bug info) >+ NewVersion( $DBversion, 23019, "Add import_batches_profile table and profile_id column in import_batches"); >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index c5a3879662..67e09bcc77 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -692,6 +692,27 @@ CREATE TABLE `export_format` ( > PRIMARY KEY (`export_format_id`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Used for CSV export'; > >+-- >+-- Table structure for table `import_batches_profile` >+-- >+ >+DROP TABLE IF EXISTS `import_batches_profile`; >+CREATE TABLE `import_batches_profile` ( -- profile for batches of marc records to be imported >+ `profile_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 (`profile_id`) >+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; >+ > -- > -- Table structure for table `import_batches` > -- >@@ -713,8 +734,11 @@ CREATE TABLE `import_batches` ( -- information about batches of marc records tha > `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio', -- type of record in the batch > `file_name` varchar(100), -- the name of the file uploaded > `comments` LONGTEXT, -- any comments added when the file was uploaded >+ `profile_id` int(11) default NULL, > PRIMARY KEY (`import_batch_id`), >- KEY `branchcode` (`branchcode`) >+ KEY `branchcode` (`branchcode`), >+ CONSTRAINT `import_batches_ibfk_1` FOREIGN KEY (`profile_id`) >+ REFERENCES `import_batches_profile` (`profile_id`) ON DELETE SET NULL ON UPDATE SET NULL > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >-- >2.25.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23019
:
104972
|
104973
|
104974
|
104975
|
104976
|
105536
|
105537
|
105538
|
105539
|
105540
|
105541
|
105555
|
105600
|
105601
|
105602
|
105603
|
105604
|
106555
|
109265
|
109266
|
109637
|
112531
|
112532
|
112533
|
112534
|
112535
|
112536
|
112537
|
112715
|
112716
|
112717
|
112718
|
112719
|
112720
|
112721
|
112722
|
113276
|
113277
|
113311
|
113416
|
113421