Bugzilla – Attachment 166310 Details for
Bug 36755
Increase length of 'code' column in borrower_attribute_types
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36755: Atomicupdate file
Bug-36755-Atomicupdate-file.patch (text/plain), 5.13 KB, created by
Kyle M Hall (khall)
on 2024-05-07 16:37:32 UTC
(
hide
)
Description:
Bug 36755: Atomicupdate file
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-05-07 16:37:32 UTC
Size:
5.13 KB
patch
obsolete
>From 194b94693e5446752f0a3f852e006a26c0beca37 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 2 May 2024 13:19:05 +0000 >Subject: [PATCH] Bug 36755: Atomicupdate file > >Test plan, k-t-d: >1) Apply patches. >2) Run the following SQL and save the output of each: > SHOW CREATE TABLE pseudonymized_borrower_attributes; > SHOW CREATE TABLE borrower_attribute_types_branches; > SHOW CREATE TABLE borrower_attributes; > SHOW CREATE TABLE borrower_attribute_types; >3) Run updatedatabase >4) Run the SQL queries again, compare the output of each with the previous output before updatedatabase. >5) Make sure the only diff between the two is VARCHAR(10) -> VARCHAR(64) > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../data/mysql/atomicupdate/bug_36755.pl | 72 +++++++++++++++++++ > 1 file changed, 72 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_36755.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_36755.pl b/installer/data/mysql/atomicupdate/bug_36755.pl >new file mode 100755 >index 00000000000..79116c24a6b >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_36755.pl >@@ -0,0 +1,72 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "36755", >+ description => "Increase length of 'code' column in borrower_attribute_types", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ # Drop related tables constraints >+ if ( foreign_key_exists( 'pseudonymized_borrower_attributes', 'anonymized_borrower_attributes_ibfk_2' ) ) { >+ $dbh->do( >+ q{ALTER TABLE pseudonymized_borrower_attributes DROP FOREIGN KEY anonymized_borrower_attributes_ibfk_2} >+ ); >+ } >+ if ( foreign_key_exists( 'borrower_attribute_types_branches', 'borrower_attribute_types_branches_ibfk_1' ) ) { >+ $dbh->do( >+ q{ALTER TABLE borrower_attribute_types_branches DROP FOREIGN KEY borrower_attribute_types_branches_ibfk_1} >+ ); >+ } >+ if ( foreign_key_exists( 'borrower_attributes', 'borrower_attributes_ibfk_2' ) ) { >+ $dbh->do(q{ALTER TABLE borrower_attributes DROP FOREIGN KEY borrower_attributes_ibfk_2}); >+ } >+ >+ # Update the column we want >+ unless ( foreign_key_exists( 'pseudonymized_borrower_attributes', 'anonymized_borrower_attributes_ibfk_2' ) >+ || foreign_key_exists( 'borrower_attribute_types_branches', 'borrower_attribute_types_branches_ibfk_1' ) >+ || foreign_key_exists( 'borrower_attributes', 'borrower_attributes_ibfk_2' ) ) >+ { >+ $dbh->do( >+ q{ALTER TABLE borrower_attribute_types MODIFY COLUMN code VARCHAR(64) NOT NULL COMMENT 'unique key used to identify each custom field'} >+ ); >+ } >+ >+ # Update the related tables >+ unless ( foreign_key_exists( 'pseudonymized_borrower_attributes', 'anonymized_borrower_attributes_ibfk_2' ) ) { >+ $dbh->do( >+ q{ALTER TABLE pseudonymized_borrower_attributes MODIFY COLUMN code VARCHAR(64) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for'} >+ ); >+ } >+ unless ( foreign_key_exists( 'borrower_attribute_types_branches', 'borrower_attribute_types_branches_ibfk_1' ) ) >+ { >+ $dbh->do(q{ALTER TABLE borrower_attribute_types_branches MODIFY COLUMN bat_code VARCHAR(64) DEFAULT NULL}); >+ } >+ unless ( foreign_key_exists( 'borrower_attributes', 'borrower_attributes_ibfk_2' ) ) { >+ $dbh->do( >+ q{ALTER TABLE borrower_attributes MODIFY COLUMN code VARCHAR(64) NOT NULL COMMENT 'foreign key from the borrower_attribute_types table, defines which custom field this value was entered for'} >+ ); >+ } >+ >+ # Restore related tables constraints >+ unless ( foreign_key_exists( 'pseudonymized_borrower_attributes', 'anonymized_borrower_attributes_ibfk_2' ) ) { >+ $dbh->do( >+ q{ALTER TABLE pseudonymized_borrower_attributes ADD CONSTRAINT anonymized_borrower_attributes_ibfk_2 FOREIGN KEY (code) REFERENCES borrower_attribute_types(code) ON DELETE CASCADE ON UPDATE CASCADE} >+ ); >+ } >+ unless ( foreign_key_exists( 'borrower_attribute_types_branches', 'borrower_attribute_types_branches_ibfk_1' ) ) >+ { >+ $dbh->do( >+ q{ALTER TABLE borrower_attribute_types_branches ADD CONSTRAINT borrower_attribute_types_branches_ibfk_1 FOREIGN KEY (bat_code) REFERENCES borrower_attribute_types(code) ON DELETE CASCADE} >+ ); >+ } >+ unless ( foreign_key_exists( 'borrower_attributes', 'borrower_attributes_ibfk_2' ) ) { >+ $dbh->do( >+ q{ALTER TABLE borrower_attributes ADD CONSTRAINT borrower_attributes_ibfk_2 FOREIGN KEY (code) REFERENCES borrower_attribute_types(code) ON DELETE CASCADE ON UPDATE CASCADE} >+ ); >+ } >+ >+ # HTML customizations >+ say $out "Increased borrower_attribute_types.code column length from 10 to 64"; >+ }, >+}; >-- >2.30.2
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 36755
:
166070
|
166071
|
166086
|
166087
|
166088
|
166309
|
166310
|
166311
|
166351
|
166352
|
166353