Bugzilla – Attachment 101965 Details for
Bug 18177
Remove unused columns in aqbooksellers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18177: Do not remove columns if at least one value exists
Bug-18177-Do-not-remove-columns-if-at-least-one-va.patch (text/plain), 1.62 KB, created by
Marcel de Rooy
on 2020-03-27 08:26:24 UTC
(
hide
)
Description:
Bug 18177: Do not remove columns if at least one value exists
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-03-27 08:26:24 UTC
Size:
1.62 KB
patch
obsolete
>From 77d9cc39de9d62a7644334654fbbc0dc5c8a3675 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 24 Mar 2020 16:22:33 +0100 >Subject: [PATCH] Bug 18177: Do not remove columns if at least one value exists >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > installer/data/mysql/atomicupdate/bug_18177.perl | 15 ++++++++++++--- > 1 file changed, 12 insertions(+), 3 deletions(-) > >diff --git a/installer/data/mysql/atomicupdate/bug_18177.perl b/installer/data/mysql/atomicupdate/bug_18177.perl >index 0426fda963..61b0e5e543 100644 >--- a/installer/data/mysql/atomicupdate/bug_18177.perl >+++ b/installer/data/mysql/atomicupdate/bug_18177.perl >@@ -3,10 +3,19 @@ if( CheckVersion( $DBversion ) ) { > > for my $column ( qw(othersupplier booksellerfax booksellerurl bookselleremail currency) ) { > if( column_exists( 'aqbooksellers', $column ) ) { >- $dbh->do(qq| >- ALTER TABLE aqbooksellers >- DROP COLUMN $column >+ my ($count) = $dbh->selectrow_array(qq| >+ SELECT COUNT(*) >+ FROM aqbooksellers >+ WHERE $column IS NOT NULL AND $column <> "" > |); >+ if ( $count ) { >+ warn "Warning - Cannot remove column aqbooksellers.$column. At least one value exists"; >+ } else { >+ $dbh->do(qq| >+ ALTER TABLE aqbooksellers >+ DROP COLUMN $column >+ |); >+ } > } > } > >-- >2.11.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 18177
:
100861
|
100862
|
100863
|
100864
|
100865
|
100866
|
100867
|
100868
|
100869
|
100870
|
100871
|
100872
|
100873
|
100874
|
101612
|
101687
|
101688
|
101689
|
101690
|
101691
|
101692
|
101693
|
101694
|
101958
|
101959
|
101960
|
101961
|
101962
|
101963
|
101964
| 101965 |
102011