Bugzilla – Attachment 100876 Details for
Bug 15272
aqbookseller addresses are combined into "physical address" field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15272: DB changes
Bug-15272-DB-changes.patch (text/plain), 3.06 KB, created by
Jonathan Druart
on 2020-03-17 09:57:52 UTC
(
hide
)
Description:
Bug 15272: DB changes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-17 09:57:52 UTC
Size:
3.06 KB
patch
obsolete
>From 16cf78289a5c1d47263c476c23bcdfddcb0f110b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 17 Mar 2020 10:45:47 +0100 >Subject: [PATCH] Bug 15272: DB changes > >--- > .../data/mysql/atomicupdate/bug_15272.perl | 37 +++++++++++++++++++ > installer/data/mysql/kohastructure.sql | 5 +-- > 2 files changed, 38 insertions(+), 4 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_15272.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_15272.perl b/installer/data/mysql/atomicupdate/bug_15272.perl >new file mode 100644 >index 0000000000..c10f595792 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_15272.perl >@@ -0,0 +1,37 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ >+ unless ( column_exists('aqbooksellers', 'address') ) { >+ $dbh->do(q| >+ ALTER TABLE aqbooksellers >+ ADD COLUMN address LONGTEXT >+ AFTER name >+ |); >+ $dbh->do(q| >+ UPDATE aqbooksellers >+ SET address = CONCAT(address1, "\r\n", address2, "\r\n", address3, "\r\n", address4) >+ |); >+ $dbh->do(q| >+ ALTER TABLE aqbooksellers >+ DROP COLUMN address1, >+ DROP COLUMN address2, >+ DROP COLUMN address3, >+ DROP COLUMN address4 >+ |); >+ $dbh->do(q| >+ UPDATE letter SET content=REPLACE(content, "<<aqbooksellers.address1>>\n<<aqbooksellers.address2>>\n<<aqbooksellers.address3>>\n<<aqbooksellers.address4>>\n", "<<aqbooksellers.address>>\n"); >+ |); >+ >+ my $occurrences_left = $dbh->selectall_arrayref(q| >+ SELECT code, name >+ FROM letter >+ WHERE content LIKE "%address4%" >+ |); >+ for my $o ( @$occurrences_left ) { >+ warn sprintf "Letter '%s' (%s) still use 'address4' from aqbooksellers, but the column has been removed (same for address1, address2 and address3)" >+ } >+ } >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 15272 - Merge columns aqbooksellers.addressX into address)\n"; >+} >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index e3d0d09760..02889afa84 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2759,10 +2759,7 @@ DROP TABLE IF EXISTS `aqbooksellers`; > CREATE TABLE `aqbooksellers` ( -- information about the vendors listed in acquisitions > `id` int(11) NOT NULL auto_increment, -- primary key and unique identifier assigned by Koha > `name` LONGTEXT NOT NULL, -- vendor name >- `address1` LONGTEXT, -- first line of vendor physical address >- `address2` LONGTEXT, -- second line of vendor physical address >- `address3` LONGTEXT, -- third line of vendor physical address >- `address4` LONGTEXT, -- fourth line of vendor physical address >+ `address` LONGTEXT, -- vendor physical address > `phone` varchar(30) default NULL, -- vendor phone number > `accountnumber` LONGTEXT, -- vendor account number > `notes` LONGTEXT, -- order notes >-- >2.20.1
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 15272
:
100875
|
100876
|
100877
|
100878
|
100879
|
102349
|
102350
|
102351
|
102352
|
102353