Bugzilla – Attachment 59004 Details for
Bug 17914
The installer process tries to create borrowers.updated_on twice
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17914: Do not try and add the updated_on columns to the borrowers and deletedborrowers table
Bug-17914-Do-not-try-and-add-the-updatedon-columns.patch (text/plain), 2.61 KB, created by
Jonathan Druart
on 2017-01-16 11:00:49 UTC
(
hide
)
Description:
Bug 17914: Do not try and add the updated_on columns to the borrowers and deletedborrowers table
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-01-16 11:00:49 UTC
Size:
2.61 KB
patch
obsolete
>From eff47bfe7f0cc9f506eb91313f8817a5c43a18f2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 16 Jan 2017 11:51:01 +0100 >Subject: [PATCH] Bug 17914: Do not try and add the updated_on columns to the > borrowers and deletedborrowers table > >Bug 10459 has been backported and the DB entry (add borrowers.updated_on and >deletedborrower.updated_on) is now played in > - 16.06.00.027 > - 16.05.00.002 > - 3.22.08.001 > >This will raise a MySQL warning if the column already exists. > DBD::mysql::db do failed: Duplicate column name 'updated_on' > >Since bug 17234 we have now a subroutine (C4::Installer::column_exists) to test >if a column exists. >When a DB entry modifying the DB structure is backported, it HAS TO check if the >column, constraint or table exists before executing the query. > >Test plan: >git checkout 3.22.x (16.05.x or 16.11.x) >install Koha >git checkout master >execute the installer >=> Without this patch you will get a warning when adding borrowers.updated_on) >=> With this patch, you should not get it >--- > installer/data/mysql/updatedatabase.pl | 26 ++++++++++++++------------ > 1 file changed, 14 insertions(+), 12 deletions(-) > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d024b12..742c737 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -12669,18 +12669,20 @@ if ( CheckVersion($DBversion) ) { > > $DBversion = "16.06.00.002"; > if ( CheckVersion($DBversion) ) { >- $dbh->do(q{ >- ALTER TABLE borrowers >- ADD COLUMN updated_on timestamp NULL DEFAULT CURRENT_TIMESTAMP >- ON UPDATE CURRENT_TIMESTAMP >- AFTER privacy_guarantor_checkouts; >- }); >- $dbh->do(q{ >- ALTER TABLE deletedborrowers >- ADD COLUMN updated_on timestamp NULL DEFAULT CURRENT_TIMESTAMP >- ON UPDATE CURRENT_TIMESTAMP >- AFTER privacy_guarantor_checkouts; >- }); >+ unless ( column_exists('borrowers', 'updated_on') ) { >+ $dbh->do(q{ >+ ALTER TABLE borrowers >+ ADD COLUMN updated_on timestamp NULL DEFAULT CURRENT_TIMESTAMP >+ ON UPDATE CURRENT_TIMESTAMP >+ AFTER privacy_guarantor_checkouts; >+ }); >+ $dbh->do(q{ >+ ALTER TABLE deletedborrowers >+ ADD COLUMN updated_on timestamp NULL DEFAULT CURRENT_TIMESTAMP >+ ON UPDATE CURRENT_TIMESTAMP >+ AFTER privacy_guarantor_checkouts; >+ }); >+ } > > print "Upgrade to $DBversion done (Bug 10459 - borrowers should have a timestamp)\n"; > SetVersion($DBversion); >-- >2.9.3
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 17914
:
59004
|
59018
|
59095