Bugzilla – Attachment 58879 Details for
Bug 17813
Table borrower_attributes needs a primary key
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17813: (QA followup) Properly check DB structure before altering it
Bug-17813-QA-followup-Properly-check-DB-structure-.patch (text/plain), 2.46 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-01-12 15:11:41 UTC
(
hide
)
Description:
Bug 17813: (QA followup) Properly check DB structure before altering it
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-01-12 15:11:41 UTC
Size:
2.46 KB
patch
obsolete
>From 41d0c2347aa67931a14b49864b0ae2dff1ed3a90 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 12 Jan 2017 12:09:42 -0300 >Subject: [PATCH] Bug 17813: (QA followup) Properly check DB structure before > altering it > >This patch makes the atomic update use the new functions introduced by >bug 17234 for checking the structure before attempting to call ALTER >TABLE. > >It checks for the column existence, and also if it is a primary key. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > .../atomicupdate/bug_17813_borrower_attributes_pk.perl | 14 ++++++++++++++ > .../atomicupdate/bug_17813_borrower_attributes_pk.sql | 11 ----------- > 2 files changed, 14 insertions(+), 11 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_17813_borrower_attributes_pk.perl > delete mode 100644 installer/data/mysql/atomicupdate/bug_17813_borrower_attributes_pk.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_17813_borrower_attributes_pk.perl b/installer/data/mysql/atomicupdate/bug_17813_borrower_attributes_pk.perl >new file mode 100644 >index 0000000000..bb0e5f8a37 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_17813_borrower_attributes_pk.perl >@@ -0,0 +1,14 @@ >+$DBversion = "16.12.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ unless ( column_exists( 'borrower_attributes', 'id' ) >+ and index_exists( 'borrower_attributes', 'PRIMARY' ) ) >+ { >+ $dbh->do(q{ >+ ALTER TABLE `borrower_attributes` >+ ADD `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST >+ }); >+ } >+ >+ print "Upgrade to $DBversion done (Bug 17813: Table borrower_attributes needs a primary key\n"; >+ SetVersion($DBversion); >+} >diff --git a/installer/data/mysql/atomicupdate/bug_17813_borrower_attributes_pk.sql b/installer/data/mysql/atomicupdate/bug_17813_borrower_attributes_pk.sql >deleted file mode 100644 >index 04da55daf9..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_17813_borrower_attributes_pk.sql >+++ /dev/null >@@ -1,11 +0,0 @@ >-ALTER TABLE `borrower_attributes` ADD `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST; >- >--- $DBversion = "16.12.00.XXX"; >--- if(CheckVersion($DBversion)) { >--- $dbh->do(q{ >--- ALTER TABLE `borrower_attributes` ADD `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST >--- }); >--- >--- print "Upgrade to $DBversion done (Bug 17813: Table borrower_attributes needs a primary key\n"; >--- SetVersion ($DBversion); >--- } >-- >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 17813
:
58422
|
58423
|
58493
|
58494
|
58879
|
59070
|
59071
|
59072