Bugzilla – Attachment 160446 Details for
Bug 35539
Remove unused columns from categories table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35539: Atomicupdate
Bug-35539-Atomicupdate.patch (text/plain), 3.53 KB, created by
Pedro Amorim
on 2024-01-03 10:25:49 UTC
(
hide
)
Description:
Bug 35539: Atomicupdate
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-01-03 10:25:49 UTC
Size:
3.53 KB
patch
obsolete
>From 270acaf4c0c9fd95654014d273743ade76d3d3eb Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Tue, 2 Jan 2024 12:19:20 +0000 >Subject: [PATCH] Bug 35539: Atomicupdate > >Removal of 'bulk' column >Removal of 'finetype' column >Removal of 'issuelimit' column > >Test plan, k-t-d: >1) Add data to the relevant columns, run the following mysql: >update categories set bulk = 1; >update categories set finetype = 1; >update categories set issuelimit = 1; >2) Run updatedatabase, notice it shows a warning and does not update the database >3) Clean up the data, run the folllowing mysql: >update categories set bulk = null; >update categories set finetype = null; >update categories set issuelimit = null; >4) Run updatedatabase again, notice it updates the database as intended > >Run: >t/db_dependent/Circulation/GetHardDueDate.t > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../data/mysql/atomicupdate/bug_35539.pl | 65 +++++++++++++++++++ > 1 file changed, 65 insertions(+) > create mode 100755 installer/data/mysql/atomicupdate/bug_35539.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_35539.pl b/installer/data/mysql/atomicupdate/bug_35539.pl >new file mode 100755 >index 0000000000..f54e8c14a7 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_35539.pl >@@ -0,0 +1,65 @@ >+use Modern::Perl; >+ >+use Term::ANSIColor; >+ >+return { >+ bug_number => "35539", >+ description => "Remove unused columns from 'categories' table", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ if ( column_exists( 'categories', 'bulk' ) ) { >+ my ($bulkdata) = $dbh->selectrow_array( >+ q| >+ SELECT bulk FROM categories; >+ | >+ ); >+ if ($bulkdata) { >+ say $out colored( >+ "Data was found in 'bulk' column in 'categories' table. Please remove this data and run the update again.", >+ 'yellow' >+ ); >+ } else { >+ $dbh->do("ALTER TABLE categories DROP COLUMN bulk"); >+ say $out "Removed 'bulk' column from 'categories' table"; >+ } >+ } >+ >+ if ( column_exists( 'categories', 'finetype' ) ) { >+ my ($bulkdata) = $dbh->selectrow_array( >+ q| >+ SELECT finetype FROM categories; >+ | >+ ); >+ if ($bulkdata) { >+ say $out colored( >+ "Data was found in 'finetype' column in 'categories' table. Please remove this data and run the update again.", >+ 'yellow' >+ ); >+ >+ } else { >+ $dbh->do("ALTER TABLE categories DROP COLUMN finetype"); >+ say $out "Removed 'finetype' column from 'categories' table"; >+ } >+ } >+ >+ if ( column_exists( 'categories', 'issuelimit' ) ) { >+ my ($bulkdata) = $dbh->selectrow_array( >+ q| >+ SELECT issuelimit FROM categories; >+ | >+ ); >+ if ($bulkdata) { >+ say $out colored( >+ "Data was found in 'issuelimit' column in 'categories' table. Please remove this data and run the update again.", >+ 'yellow' >+ ); >+ } else { >+ $dbh->do("ALTER TABLE categories DROP COLUMN issuelimit"); >+ say $out "Removed 'issuelimit' column from 'categories' table"; >+ } >+ } >+ say $out "Bug 35539: All done."; >+ }, >+}; >-- >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 35539
:
160400
|
160401
|
160402
|
160403
|
160404
|
160413
|
160414
|
160415
|
160416
|
160417
|
160446
|
165724
|
169209
|
169210
|
169211
|
169212
|
169213
|
169214