Bugzilla – Attachment 173305 Details for
Bug 22421
accountlines.issue_id is missing a foreign key constraint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22421: (follow-up) Improve recoverability if dbrev fails in the middle
Bug-22421-follow-up-Improve-recoverability-if-dbre.patch (text/plain), 3.61 KB, created by
Emily Lamancusa (emlam)
on 2024-10-24 18:39:37 UTC
(
hide
)
Description:
Bug 22421: (follow-up) Improve recoverability if dbrev fails in the middle
Filename:
MIME Type:
Creator:
Emily Lamancusa (emlam)
Created:
2024-10-24 18:39:37 UTC
Size:
3.61 KB
patch
obsolete
>From 137d84cf3ed9d43d04c1c272843765aa657b4bbb Mon Sep 17 00:00:00 2001 >From: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >Date: Thu, 24 Oct 2024 14:24:16 -0400 >Subject: [PATCH] Bug 22421: (follow-up) Improve recoverability if dbrev fails > in the middle > >--- > .../data/mysql/atomicupdate/bug_22421.pl | 64 ++++++++++--------- > 1 file changed, 34 insertions(+), 30 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_22421.pl b/installer/data/mysql/atomicupdate/bug_22421.pl >index 766a6273a8..878fa52446 100755 >--- a/installer/data/mysql/atomicupdate/bug_22421.pl >+++ b/installer/data/mysql/atomicupdate/bug_22421.pl >@@ -16,6 +16,9 @@ return { > } > ); > say $out "Added column 'accountlines.old_issue_id'"; >+ } >+ >+ unless ( foreign_key_exists( 'accountlines', 'accountlines_ibfk_old_issues' ) ) { > > $dbh->do( > q{ >@@ -28,48 +31,49 @@ return { > } > ); > say $out "Added constraint 'accountlines.old_issues'"; >+ } >+ >+ # Add constraint for issue_id >+ unless ( foreign_key_exists( 'accountlines', 'accountlines_ibfk_issues' ) ) { > > $dbh->do( > q{ > UPDATE >- accountlines a >- LEFT JOIN old_issues o ON (a.issue_id = o.issue_id) >+ accountlines a >+ LEFT JOIN old_issues o ON (a.issue_id = o.issue_id) > SET >- a.old_issue_id = o.issue_id, >- a.issue_id = NULL >+ a.old_issue_id = o.issue_id, >+ a.issue_id = NULL > WHERE >- o.issue_id IS NOT NULL >+ o.issue_id IS NOT NULL > } > ); > say $out "Updated 'accountlines.old_issue_id' from 'old_issues'"; > >- # Add constraint for issue_id >- unless ( foreign_key_exists( 'accountlines', 'accountlines_ibfk_issues' ) ) { >- $dbh->do( >- q{ >- UPDATE >- accountlines a >- LEFT JOIN issues i ON (a.issue_id = i.issue_id) >- SET >- a.issue_id = NULL >- WHERE >- i.issue_id IS NULL >- } >- ); >- say $out "Fix accountlines.issue_id where missing from issues"; >+ $dbh->do( >+ q{ >+ UPDATE >+ accountlines a >+ LEFT JOIN issues i ON (a.issue_id = i.issue_id) >+ SET >+ a.issue_id = NULL >+ WHERE >+ i.issue_id IS NULL >+ } >+ ); >+ say $out, "Fixed accountlines.issue_id where missing from issues"; > >- $dbh->do( >- q{ >- ALTER TABLE accountlines >- ADD CONSTRAINT `accountlines_ibfk_issues` >- FOREIGN KEY (`issue_id`) >- REFERENCES `issues` (`issue_id`) >- ON DELETE SET NULL >- ON UPDATE CASCADE >- } >- ); >- say $out "Added constraint 'accountlines.issues'"; >+ $dbh->do( >+ q{ >+ ALTER TABLE accountlines >+ ADD CONSTRAINT `accountlines_ibfk_issues` >+ FOREIGN KEY (`issue_id`) >+ REFERENCES `issues` (`issue_id`) >+ ON DELETE SET NULL >+ ON UPDATE CASCADE > } >+ ); >+ say $out "Added constraint 'accountlines.issues'"; > } > > say $out "Add old_issue_id to accountlines and setup appropriate constraints)\n"; >-- >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 22421
:
85773
|
85774
|
85775
|
90352
|
90353
|
90354
|
90359
|
90360
|
90361
|
90362
|
90365
|
90366
|
90367
|
90368
|
161919
|
161920
|
161921
|
161922
|
161923
|
162244
|
162245
|
162246
|
162247
|
162248
|
166631
|
173287
|
173288
|
173289
|
173305
|
173790
|
173791
|
173792
|
173793
|
173794
|
173795
|
173796
|
173797
|
173798
|
173799
|
174281
|
174974