From dab21bbb351e718a7b24bc085fa0816e71312bc9 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 24 Aug 2022 12:34:32 +0000 Subject: [PATCH] Bug 30571: Table z3950servers: Make host, syntax and encoding NOT NULL Content-Type: text/plain; charset=utf-8 This is not a sync issue between structure and db revs. It just seems a logical move. Note that the interface for long does not allow these fields to be empty. Test plan: Run dbrev. Add a new Z3950/SRU server. Verify if it works as expected. Signed-off-by: Marcel de Rooy --- installer/data/mysql/atomicupdate/bug_30571.pl | 16 ++++++++++++++++ installer/data/mysql/kohastructure.sql | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_30571.pl diff --git a/installer/data/mysql/atomicupdate/bug_30571.pl b/installer/data/mysql/atomicupdate/bug_30571.pl new file mode 100755 index 0000000000..168bb1b93b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_30571.pl @@ -0,0 +1,16 @@ +use Modern::Perl; + +return { + bug_number => 30571, + description => "Table z3950servers: three cols NOT NULL", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{ +alter table z3950servers + change column `host` `host` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'target''s host name', + change column `syntax` `syntax` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'marc format provided by this target', + change column `encoding` `encoding` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'characters encoding provided by this target'; + }); + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 7eafe84413..85dc23ffdc 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -5543,7 +5543,7 @@ DROP TABLE IF EXISTS `z3950servers`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `z3950servers` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'unique identifier assigned by Koha', - `host` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'target''s host name', + `host` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'target''s host name', `port` int(11) DEFAULT NULL COMMENT 'port number used to connect to target', `db` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'target''s database name', `userid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'username needed to log in to target', @@ -5551,10 +5551,10 @@ CREATE TABLE `z3950servers` ( `servername` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'name given to the target by the library', `checked` smallint(6) DEFAULT NULL COMMENT 'whether this target is checked by default (1 for yes, 0 for no)', `rank` int(11) DEFAULT NULL COMMENT 'where this target appears in the list of targets', - `syntax` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'marc format provided by this target', + `syntax` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'marc format provided by this target', `timeout` int(11) NOT NULL DEFAULT 0 COMMENT 'number of seconds before Koha stops trying to access this server', `servertype` enum('zed','sru') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'zed' COMMENT 'zed means z39.50 server', - `encoding` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'characters encoding provided by this target', + `encoding` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'characters encoding provided by this target', `recordtype` enum('authority','biblio') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'biblio' COMMENT 'server contains bibliographic or authority records', `sru_options` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'options like sru=get, sru_version=1.1; will be passed to the server via ZOOM', `sru_fields` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'contains the mapping between the Z3950 search fields and the specific SRU server indexes', -- 2.20.1