Bug 17216: Add FK on mss.authorised_value
Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
f97249f56e
commit
d0f543bd6c
2 changed files with 10 additions and 2 deletions
7
installer/data/mysql/atomicupdate/bug_17216_2_add_fk.sql
Normal file
7
installer/data/mysql/atomicupdate/bug_17216_2_add_fk.sql
Normal file
|
@ -0,0 +1,7 @@
|
|||
INSERT IGNORE INTO authorised_value_categories( category_name ) SELECT DISTINCT(authorised_value) FROM marc_subfield_structure;
|
||||
|
||||
UPDATE marc_subfield_structure SET authorised_value = NULL WHERE authorised_value = ';';
|
||||
|
||||
ALTER TABLE marc_subfield_structure
|
||||
MODIFY COLUMN authorised_value VARCHAR(32) DEFAULT NULL,
|
||||
ADD CONSTRAINT marc_subfield_structure_ibfk_1 FOREIGN KEY (authorised_value) REFERENCES authorised_value_categories (category_name) ON UPDATE CASCADE ON DELETE SET NULL;
|
|
@ -1120,7 +1120,7 @@ CREATE TABLE `marc_subfield_structure` (
|
|||
`mandatory` tinyint(4) NOT NULL default 0,
|
||||
`kohafield` varchar(40) default NULL,
|
||||
`tab` tinyint(1) default NULL,
|
||||
`authorised_value` varchar(20) default NULL,
|
||||
`authorised_value` varchar(32) default NULL,
|
||||
`authtypecode` varchar(20) default NULL,
|
||||
`value_builder` varchar(80) default NULL,
|
||||
`isurl` tinyint(1) default NULL,
|
||||
|
@ -1133,7 +1133,8 @@ CREATE TABLE `marc_subfield_structure` (
|
|||
PRIMARY KEY (`frameworkcode`,`tagfield`,`tagsubfield`),
|
||||
KEY `kohafield_2` (`kohafield`),
|
||||
KEY `tab` (`frameworkcode`,`tab`),
|
||||
KEY `kohafield` (`frameworkcode`,`kohafield`)
|
||||
KEY `kohafield` (`frameworkcode`,`kohafield`),
|
||||
CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY (`authorised_value`) REFERENCES `authorised_value_categories` (`category_name`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
--
|
||||
|
|
Loading…
Reference in a new issue