Bugzilla – Attachment 167589 Details for
Bug 37000
Upgrade fails at 23.12.00.044 [Bug 36120]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37000: (follow-up) Add foreign key last
Bug-37000-follow-up-Add-foreign-key-last.patch (text/plain), 2.09 KB, created by
Emily Lamancusa
on 2024-06-07 20:53:53 UTC
(
hide
)
Description:
Bug 37000: (follow-up) Add foreign key last
Filename:
MIME Type:
Creator:
Emily Lamancusa
Created:
2024-06-07 20:53:53 UTC
Size:
2.09 KB
patch
obsolete
>From 29697e3b8b2c2e130d1fd55101e9b1396aba6618 Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Fri, 7 Jun 2024 16:24:26 -0400 >Subject: [PATCH] Bug 37000: (follow-up) Add foreign key last > >Certain configurations of MySQL will not allow a column to be changed >from nullable to non-nullable if the column has a foreign key constraint. >Add the foreign key constraint last to avoid issues from this. >--- > installer/data/mysql/db_revs/231200044.pl | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/installer/data/mysql/db_revs/231200044.pl b/installer/data/mysql/db_revs/231200044.pl >index af6b69966d..7db75f74f0 100755 >--- a/installer/data/mysql/db_revs/231200044.pl >+++ b/installer/data/mysql/db_revs/231200044.pl >@@ -12,9 +12,8 @@ return { > $dbh->do( > q{ > ALTER TABLE bookings >- ADD COLUMN `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for booking pickup library' AFTER `item_id`, >- ADD CONSTRAINT `bookings_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE >- } >+ ADD COLUMN `pickup_library_id` varchar(10) DEFAULT NULL COMMENT 'Identifier for booking pickup library' AFTER `item_id` >+ } > ) == 1 > && say_success( $out, "Added column 'bookings.pickup_library_id'" ); > >@@ -59,5 +58,15 @@ return { > } > ) == 1 && say_success( $out, "Updated column 'bookings.pickup_library_id' to NOT NULL" ); > } >+ >+ unless ( foreign_key_exists( 'bookings', 'bookings_ibfk_4' ) ) { >+ $dbh->do( >+ q{ >+ ALTER TABLE bookings >+ ADD CONSTRAINT `bookings_ibfk_4` FOREIGN KEY (`pickup_library_id`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE >+ } >+ ) == 1 >+ && say_success( $out, "Added foreign key 'bookings_ibfk_4' to column 'bookings.pickup_library_id'" ); >+ } > }, > }; >-- >2.34.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 37000
:
167376
|
167563
|
167573
| 167589