Bug 35761: Database updates

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jake Deery 2025-02-14 15:55:18 +00:00 committed by Lucas Gass
parent 0de9601048
commit 2688dfd668
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
3 changed files with 73 additions and 1 deletions

View File

@ -0,0 +1,44 @@
use Modern::Perl;
return {
bug_number => "35761",
description => "Add new table and permission for generalised SFTP",
up => sub {
my ($args) = @_;
my ( $dbh, $out ) = @$args{qw(dbh out)};
$dbh->do(
q{
INSERT IGNORE INTO permissions (module_bit, code, description)
VALUES (3, 'manage_sftp_servers', 'Manage FTP/SFTP servers configuration');
}
);
say $out "Added new manage_sftp_servers permission";
unless ( TableExists('sftp_servers') ) {
$dbh->do(
q {
CREATE TABLE `sftp_servers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL,
`host` varchar(80) NOT NULL DEFAULT 'localhost',
`port` int(11) NOT NULL DEFAULT 22,
`transport` enum('ftp','sftp') NOT NULL DEFAULT 'sftp',
`passive` tinyint(1) NOT NULL DEFAULT 1,
`user_name` varchar(80) DEFAULT NULL,
`password` mediumtext DEFAULT NULL,
`key_file` mediumtext DEFAULT NULL,
`auth_mode` enum('password','key_file','noauth') NOT NULL DEFAULT 'password',
`download_directory` mediumtext DEFAULT NULL,
`upload_directory` mediumtext DEFAULT NULL,
`status` varchar(32) DEFAULT NULL,
`debug` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `host_idx` (`host`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
}
);
say $out "Added new sftp_servers table";
}
},
};

View File

@ -5988,6 +5988,33 @@ CREATE TABLE `sessions` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sftp_servers`
--
DROP TABLE IF EXISTS `sftp_servers`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `sftp_servers` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL,
`host` varchar(80) NOT NULL DEFAULT 'localhost',
`port` int(11) NOT NULL DEFAULT 22,
`transport` enum('ftp','sftp') NOT NULL DEFAULT 'sftp',
`passive` tinyint(1) NOT NULL DEFAULT 1,
`user_name` varchar(80) DEFAULT NULL,
`password` mediumtext DEFAULT NULL,
`key_file` mediumtext DEFAULT NULL,
`auth_mode` enum('password','key_file','noauth') NOT NULL DEFAULT 'password',
`download_directory` mediumtext DEFAULT NULL,
`upload_directory` mediumtext DEFAULT NULL,
`status` varchar(32) DEFAULT NULL,
`debug` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `host_idx` (`host`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `sms_providers`
--

View File

@ -39,6 +39,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
( 3, 'manage_additional_fields', 'Add, edit, or delete additional custom fields for baskets or subscriptions (also requires order_manage or edit_subscription permissions)'),
( 3, 'manage_keyboard_shortcuts', 'Manage keyboard shortcuts for the advanced cataloging editor'),
( 3, 'manage_smtp_servers', 'Manage SMTP servers configuration'),
( 3, 'manage_sftp_servers', 'Manage FTP/SFTP servers configuration'),
( 3, 'manage_background_jobs', 'Manage background jobs'),
( 3, 'manage_curbside_pickups', 'Manage curbside pickups'),
( 3, 'manage_search_filters', 'Manage custom search filters'),
@ -168,4 +169,4 @@ INSERT INTO permissions (module_bit, code, description) VALUES
(25, 'takepayment', 'Access the point of sale page and take payments'),
(26, 'manage_problem_reports', 'Manage OPAC problem reports'),
(27, 'manage_recalls', 'Manage recalls for patrons')
;
;