Bugzilla – Attachment 54984 Details for
Bug 17216
Add a new table to store authorized value categories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17216: Add FK on mss.authorised_value
Bug-17216-Add-FK-on-mssauthorisedvalue.patch (text/plain), 2.47 KB, created by
Jonathan Druart
on 2016-08-29 14:42:49 UTC
(
hide
)
Description:
Bug 17216: Add FK on mss.authorised_value
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-08-29 14:42:49 UTC
Size:
2.47 KB
patch
obsolete
>From 2372996241d2810f038ef61b1214af3e53342da6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 29 Aug 2016 14:07:27 +0100 >Subject: [PATCH] Bug 17216: Add FK on mss.authorised_value > >--- > .../mysql/atomicupdate/bug_xxxxx-add_fk_marc_sf_structure_AV.sql | 7 +++++++ > installer/data/mysql/kohastructure.sql | 5 +++-- > 2 files changed, 10 insertions(+), 2 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_xxxxx-add_fk_marc_sf_structure_AV.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_xxxxx-add_fk_marc_sf_structure_AV.sql b/installer/data/mysql/atomicupdate/bug_xxxxx-add_fk_marc_sf_structure_AV.sql >new file mode 100644 >index 0000000..0d2d50e >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_xxxxx-add_fk_marc_sf_structure_AV.sql >@@ -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; >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index a59598e..46f0828 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1118,7 +1118,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, >@@ -1131,7 +1131,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; > > -- >-- >2.8.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17216
:
54979
|
54980
|
54981
|
54982
|
54983
|
54984
|
54985
|
54987
|
54988
|
54989
|
54990
|
54991
|
54992
|
54993
|
55003
|
55004
|
55005
|
55008
|
55009
|
55010
|
55011
|
55021
|
55022
|
55023
|
55024
|
55025
|
55026
|
55027
|
55028
|
55029
|
55030
|
55031
|
55032
|
55047
|
55207
|
55208
|
55209
|
55210
|
55211
|
55212
|
55213
|
55214
|
55215
|
55216
|
55217
|
55218
|
55365
|
55366
|
55367
|
55368
|
55369
|
55370
|
55371
|
55372
|
55373
|
55374
|
55375
|
55376
|
55692
|
55693
|
55835
|
55840
|
56202
|
56203
|
56204
|
56205
|
56206
|
56207
|
56208
|
56209
|
56210
|
56211
|
56212
|
56213
|
56214
|
56215
|
56216
|
56217
|
56619
|
57729