From cae9a3b1a2616a3cc5e3dbe628bd545abd2bcc4e Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Thu, 2 Feb 2023 16:57:38 -0300 Subject: [PATCH] Bug 32607: Add table and permissions Adds a new table called import_sources and a user permission called manage_import_sources --- .../data/mysql/atomicupdate/bug_32607.pl | 32 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 14 ++++++++ .../data/mysql/mandatory/userpermissions.sql | 1 + 3 files changed, 47 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_32607.pl diff --git a/installer/data/mysql/atomicupdate/bug_32607.pl b/installer/data/mysql/atomicupdate/bug_32607.pl new file mode 100755 index 0000000000..252361d122 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_32607.pl @@ -0,0 +1,32 @@ +use Modern::Perl; + +return { + bug_number => "32607", + description => "Add import_source table", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Do you stuffs here + if(!TableExists('import_source')) { + $dbh->do(q{ + CREATE TABLE `import_source` ( + `import_source_id` int(11) NOT NULL AUTO_INCREMENT, + `name` text NOT NULL, + `patron_id` int(11) NOT NULL, + PRIMARY KEY (`import_source_id`), + CONSTRAINT `import_source_fk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci + }); + } + + say $out "Added new import_source table"; + + $dbh->do(q{ + INSERT IGNORE INTO permissions (module_bit, code, description) VALUES + ( 3, 'manage_import_sources', 'Manage import sources') + }); + + say $out "Added new manage_import_sources permission"; + + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index df66cee175..7f5267ccdf 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3391,6 +3391,20 @@ CREATE TABLE `import_items` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `import_source` +-- + +DROP TABLE IF EXISTS `import_source`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `import_source` ( + `import_source_id` int(11) NOT NULL AUTO_INCREMENT, + `name` text NOT NULL, + `patron_id` int(11) NOT NULL, + PRIMARY KEY (`import_source_id`), + CONSTRAINT `import_source_fk_1` FOREIGN KEY (`patron_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- -- Table structure for table `import_record_matches` -- diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 7b6955de44..0447d73a1d 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -42,6 +42,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES ( 3, 'manage_curbside_pickups', 'Manage curbside pickups'), ( 3, 'manage_search_filters', 'Manage custom search filters'), ( 3, 'manage_identity_providers', 'Manage authentication providers'), + ( 3, 'manage_import_sources', 'Manage import sources'), ( 4, 'delete_borrowers', 'Delete patrons'), ( 4, 'edit_borrowers', 'Add, modify and view patron information'), ( 4, 'view_borrower_infos_from_any_libraries', 'View patron infos from any libraries'), -- 2.25.1