Bugzilla – Attachment 194316 Details for
Bug 14962
Temp Shelving Location / On Display Module
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14962: (QA follow-up) Change branch/itype FK on displays to ON DELETE SET NULL
5c1c533.patch (text/plain), 4.89 KB, created by
Martin Renvoize (ashimema)
on 2026-03-02 10:25:09 UTC
(
hide
)
Description:
Bug 14962: (QA follow-up) Change branch/itype FK on displays to ON DELETE SET NULL
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-03-02 10:25:09 UTC
Size:
4.89 KB
patch
obsolete
>From 5c1c5333fe65b0428b82d4df227d547b024e284e Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Tue, 24 Feb 2026 13:03:55 +0000 >Subject: [PATCH] Bug 14962: (QA follow-up) Change branch/itype FK on displays > to ON DELETE SET NULL > >The foreign keys from displays.display_branch, display_holding_branch, >and display_itype used ON DELETE CASCADE, which would silently delete >entire displays when an admin removes a branch or item type. > >These columns are optional configuration references, not ownership >relationships (all are nullable DEFAULT NULL). Use ON DELETE SET NULL >so the display is preserved and the reference is simply cleared, which >is consistent with how items.homebranch references branches. > >Update atomicupdate, kohastructure.sql, and the DBIC schema to match. > >Sponsored-by: ByWater Solutions >Signed-of-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > Koha/Schema/Result/Display.pm | 6 +++--- > .../data/mysql/atomicupdate/bug_14962-temporary_shelves.pl | 6 +++--- > installer/data/mysql/kohastructure.sql | 6 +++--- > 3 files changed, 9 insertions(+), 9 deletions(-) > >diff --git a/Koha/Schema/Result/Display.pm b/Koha/Schema/Result/Display.pm >index 701781f3ac7..3cf2886f525 100644 >--- a/Koha/Schema/Result/Display.pm >+++ b/Koha/Schema/Result/Display.pm >@@ -205,7 +205,7 @@ __PACKAGE__->belongs_to( > { > is_deferrable => 1, > join_type => "LEFT", >- on_delete => "CASCADE", >+ on_delete => "SET NULL", > on_update => "CASCADE", > }, > ); >@@ -225,7 +225,7 @@ __PACKAGE__->belongs_to( > { > is_deferrable => 1, > join_type => "LEFT", >- on_delete => "CASCADE", >+ on_delete => "SET NULL", > on_update => "CASCADE", > }, > ); >@@ -260,7 +260,7 @@ __PACKAGE__->belongs_to( > { > is_deferrable => 1, > join_type => "LEFT", >- on_delete => "CASCADE", >+ on_delete => "SET NULL", > on_update => "CASCADE", > }, > ); >diff --git a/installer/data/mysql/atomicupdate/bug_14962-temporary_shelves.pl b/installer/data/mysql/atomicupdate/bug_14962-temporary_shelves.pl >index 102124658b4..e421ac97363 100755 >--- a/installer/data/mysql/atomicupdate/bug_14962-temporary_shelves.pl >+++ b/installer/data/mysql/atomicupdate/bug_14962-temporary_shelves.pl >@@ -30,9 +30,9 @@ return { > KEY `display_branch` (`display_branch`), > KEY `display_holding_branch` (`display_holding_branch`), > KEY `display_itype` (`display_itype`), >- CONSTRAINT `displays_ibfk_1` FOREIGN KEY (`display_branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT `displays_ibfk_2` FOREIGN KEY (`display_holding_branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT `displays_ibfk_3` FOREIGN KEY (`display_itype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE >+ CONSTRAINT `displays_ibfk_1` FOREIGN KEY (`display_branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `displays_ibfk_2` FOREIGN KEY (`display_holding_branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `displays_ibfk_3` FOREIGN KEY (`display_itype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci > } > ); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 5610d7fd865..f81f30ecce7 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2912,9 +2912,9 @@ CREATE TABLE `displays` ( > KEY `display_branch` (`display_branch`), > KEY `display_holding_branch` (`display_holding_branch`), > KEY `display_itype` (`display_itype`), >- CONSTRAINT `displays_ibfk_1` FOREIGN KEY (`display_branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT `displays_ibfk_2` FOREIGN KEY (`display_holding_branch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT `displays_ibfk_3` FOREIGN KEY (`display_itype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE CASCADE ON UPDATE CASCADE >+ CONSTRAINT `displays_ibfk_1` FOREIGN KEY (`display_branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `displays_ibfk_2` FOREIGN KEY (`display_holding_branch`) REFERENCES `branches` (`branchcode`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT `displays_ibfk_3` FOREIGN KEY (`display_itype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > /*!40101 SET character_set_client = @saved_cs_client */; > >-- >2.53.0 >
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 14962
:
190216
|
190217
|
190218
|
190219
|
190220
|
190221
|
190222
|
190223
|
190224
|
190225
|
190226
|
190227
|
190228
|
190229
|
190230
|
190231
|
190232
|
190571
|
190572
|
193719
|
193720
|
193721
|
193722
|
193723
|
193724
|
193725
|
193726
|
193727
|
193728
|
193729
|
193730
|
193731
|
193732
|
193733
|
193734
|
193735
|
193736
|
193737
|
193738
|
193739
|
193740
|
193741
|
193742
|
193743
|
193744
|
193745
|
193746
|
193747
|
193748
|
193749
|
193750
|
193751
|
193752
|
193753
|
193754
|
193755
|
194285
|
194286
|
194287
|
194288
|
194289
|
194290
|
194291
|
194292
|
194293
|
194294
|
194295
|
194296
|
194297
|
194298
|
194299
|
194300
|
194301
|
194302
|
194303
|
194304
|
194305
|
194306
|
194307
|
194308
|
194309
|
194310
|
194311
|
194312
|
194313
|
194314
|
194315
| 194316 |
194317
|
194318
|
194320
|
194321
|
194322