Bugzilla – Attachment 30584 Details for
Bug 10363
Move authorised value related code into its own package
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10363: DB Changes: Adds a unique key for the authorised values table.
Bug-10363-DB-Changes-Adds-a-unique-key-for-the-aut.patch (text/plain), 2.74 KB, created by
Yohann Dufour
on 2014-08-07 14:43:00 UTC
(
hide
)
Description:
Bug 10363: DB Changes: Adds a unique key for the authorised values table.
Filename:
MIME Type:
Creator:
Yohann Dufour
Created:
2014-08-07 14:43:00 UTC
Size:
2.74 KB
patch
obsolete
>From 08297c9495a80de9689049a928362ee5e82d53ab Mon Sep 17 00:00:00 2001 >From: Yohann Dufour <dufour.yohann@gmail.com> >Date: Thu, 7 Aug 2014 16:40:06 +0200 >Subject: [PATCH] Bug 10363: DB Changes: Adds a unique key for the authorised > values table. > >--- > Koha/Schema/Result/AuthorisedValue.pm | 20 ++++++++++++++++++-- > installer/data/mysql/kohastructure.sql | 1 + > installer/data/mysql/updatedatabase.pl | 10 ++++++++++ > 3 files changed, 29 insertions(+), 2 deletions(-) > >diff --git a/Koha/Schema/Result/AuthorisedValue.pm b/Koha/Schema/Result/AuthorisedValue.pm >index 0366aec..e1495b2 100644 >--- a/Koha/Schema/Result/AuthorisedValue.pm >+++ b/Koha/Schema/Result/AuthorisedValue.pm >@@ -90,6 +90,22 @@ __PACKAGE__->add_columns( > > __PACKAGE__->set_primary_key("id"); > >+=head1 UNIQUE CONSTRAINTS >+ >+=head2 C<av_uniq> >+ >+=over 4 >+ >+=item * L</category> >+ >+=item * L</authorised_value> >+ >+=back >+ >+=cut >+ >+__PACKAGE__->add_unique_constraint("av_uniq", ["category", "authorised_value"]); >+ > =head1 RELATIONS > > =head2 authorised_values_branches >@@ -108,8 +124,8 @@ __PACKAGE__->has_many( > ); > > >-# Created by DBIx::Class::Schema::Loader v0.07025 @ 2013-10-14 20:56:21 >-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:N6Q7Y4sHL03X170zJ3APUA >+# Created by DBIx::Class::Schema::Loader v0.07039 @ 2014-08-05 16:05:45 >+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9LllSeL5DPjwR2ucEOqU8w > > > # You can replace this text with custom content, and it will be preserved on regeneration >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index b46dc6a..102f367 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -104,6 +104,7 @@ CREATE TABLE `authorised_values` ( -- stores values for authorized values catego > `lib_opac` varchar(200) default NULL, -- authorized value description as printed in the OPAC > `imageurl` varchar(200) default NULL, -- authorized value URL > PRIMARY KEY (`id`), >+ UNIQUE KEY `av_uniq` (`category`,`authorised_value`), > KEY `name` (`category`), > KEY `lib` (`lib`), > KEY `auth_value_idx` (`authorised_value`) >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 531bb12..8f271c6 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8589,6 +8589,16 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.17.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q{ >+ ALTER TABLE authorised_values ADD UNIQUE KEY av_uniq(category, authorised_value); >+ }); >+ print "Upgrade to $DBversion done (Bug XXXXX: Add unique key on the authorised_values table)\n"; >+ SetVersion($DBversion); >+} >+ >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >-- >1.9.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 10363
:
18430
|
18431
|
18432
|
18751
|
18752
|
18753
|
20729
|
21833
|
21834
|
21835
|
21836
|
25284
|
25285
|
25286
|
25287
|
30583
|
30584
|
30585
|
30710
|
30711
|
30712
|
31565
|
32632
|
32633
|
32634
|
33416
|
33417
|
33422
|
33423
|
33860
|
33861
|
33862
|
33889
|
33949
|
35838
|
35839
|
35840
|
35841
|
41290
|
41291
|
41292
|
41293
|
41294
|
41302
|
41343
|
41344
|
41345
|
43112
|
43113
|
43114
|
43550
|
43551
|
43552
|
43553
|
43554
|
43555
|
43556
|
43557
|
43558
|
43559
|
43696
|
43827