Bug 30571: Table z3950servers: Make host, syntax and encoding NOT NULL
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 24 Aug 2022 12:34:32 +0000 (12:34 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Mon, 3 Oct 2022 11:29:24 +0000 (08:29 -0300)
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 <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
installer/data/mysql/atomicupdate/bug_30571.pl [new file with mode: 0755]
installer/data/mysql/kohastructure.sql

diff --git a/installer/data/mysql/atomicupdate/bug_30571.pl b/installer/data/mysql/atomicupdate/bug_30571.pl
new file mode 100755 (executable)
index 0000000..168bb1b
--- /dev/null
@@ -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';
+        });
+    },
+};
index ce0c4ea..4ea450a 100644 (file)
@@ -5555,7 +5555,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',
@@ -5563,10 +5563,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',