Bug 29336: Identify the fields with wrong length (or name) first

This report will fix the bad lengths first.
And mark the 'bad' names with a TODO for follow-up.
Bad name means: refers to value, should be category.
Scanning kohastructure.sql.

Note: Bug 29347 has been opened to fix the names.

Test plan:
Search for another AV category field with length<>32.
Bonus: Reinstall and check database.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Marcel de Rooy 2021-10-28 11:45:39 +00:00 committed by Fridolin Somers
parent 34248e5805
commit 1d5332deb6

View file

@ -240,7 +240,7 @@ CREATE TABLE `additional_fields` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier', `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key identifier',
`tablename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'tablename of the new field', `tablename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'tablename of the new field',
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'name of the field', `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'name of the field',
`authorised_value_category` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'is an authorised value category', `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'is an authorised value category',
`marcfield` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record', `marcfield` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'contains the marc field to copied into the record',
`searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?', `searchable` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'is the field searchable?',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
@ -854,7 +854,7 @@ CREATE TABLE `auth_subfield_structure` (
`repeatable` tinyint(4) NOT NULL DEFAULT 0, `repeatable` tinyint(4) NOT NULL DEFAULT 0,
`mandatory` tinyint(4) NOT NULL DEFAULT 0, `mandatory` tinyint(4) NOT NULL DEFAULT 0,
`tab` tinyint(1) DEFAULT NULL, `tab` tinyint(1) DEFAULT NULL,
`authorised_value` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '#TODO This is a AV category!',
`value_builder` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `value_builder` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`seealso` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `seealso` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`isurl` tinyint(1) DEFAULT NULL, `isurl` tinyint(1) DEFAULT NULL,
@ -884,7 +884,7 @@ CREATE TABLE `auth_tag_structure` (
`libopac` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `libopac` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`repeatable` tinyint(4) NOT NULL DEFAULT 0, `repeatable` tinyint(4) NOT NULL DEFAULT 0,
`mandatory` tinyint(4) NOT NULL DEFAULT 0, `mandatory` tinyint(4) NOT NULL DEFAULT 0,
`authorised_value` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '#TODO This is a AV category!',
PRIMARY KEY (`authtypecode`,`tagfield`), PRIMARY KEY (`authtypecode`,`tagfield`),
CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE CONSTRAINT `auth_tag_structure_ibfk_1` FOREIGN KEY (`authtypecode`) REFERENCES `auth_types` (`authtypecode`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@ -1899,7 +1899,7 @@ CREATE TABLE `club_template_enrollment_fields` (
`club_template_id` int(11) NOT NULL, `club_template_id` int(11) NOT NULL,
`name` text COLLATE utf8mb4_unicode_ci NOT NULL, `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
`description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`authorised_value_category` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `club_template_id` (`club_template_id`), KEY `club_template_id` (`club_template_id`),
CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE CONSTRAINT `club_template_enrollment_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -1918,7 +1918,7 @@ CREATE TABLE `club_template_fields` (
`club_template_id` int(11) NOT NULL, `club_template_id` int(11) NOT NULL,
`name` text COLLATE utf8mb4_unicode_ci NOT NULL, `name` text COLLATE utf8mb4_unicode_ci NOT NULL,
`description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, `description` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`authorised_value_category` varchar(16) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `authorised_value_category` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `club_template_id` (`club_template_id`), KEY `club_template_id` (`club_template_id`),
CONSTRAINT `club_template_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE CONSTRAINT `club_template_fields_ibfk_1` FOREIGN KEY (`club_template_id`) REFERENCES `club_templates` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
@ -3502,7 +3502,7 @@ CREATE TABLE `marc_subfield_structure` (
`important` tinyint(4) NOT NULL DEFAULT 0, `important` tinyint(4) NOT NULL DEFAULT 0,
`kohafield` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `kohafield` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`tab` tinyint(1) DEFAULT NULL, `tab` tinyint(1) DEFAULT NULL,
`authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '#TODO This is a AV category!',
`authtypecode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `authtypecode` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`value_builder` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `value_builder` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`isurl` tinyint(1) DEFAULT NULL, `isurl` tinyint(1) DEFAULT NULL,
@ -3536,7 +3536,7 @@ CREATE TABLE `marc_tag_structure` (
`repeatable` tinyint(4) NOT NULL DEFAULT 0, `repeatable` tinyint(4) NOT NULL DEFAULT 0,
`mandatory` tinyint(4) NOT NULL DEFAULT 0, `mandatory` tinyint(4) NOT NULL DEFAULT 0,
`important` tinyint(4) NOT NULL DEFAULT 0, `important` tinyint(4) NOT NULL DEFAULT 0,
`authorised_value` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL, `authorised_value` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '#TODO This is a AV category!',
`ind1_defaultvalue` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `ind1_defaultvalue` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`ind2_defaultvalue` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `ind2_defaultvalue` varchar(1) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
`frameworkcode` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '', `frameworkcode` varchar(4) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',