Bugzilla – Attachment 48600 Details for
Bug 15084
Move the currency related code to Koha::Acquisition::Currenc[y|ies]
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15084: DB Changes - add currency.archived and FK on aqorders.currency
Bug-15084-DB-Changes---add-currencyarchived-and-FK.patch (text/plain), 1.45 KB, created by
Jonathan Druart
on 2016-03-03 08:42:22 UTC
(
hide
)
Description:
Bug 15084: DB Changes - add currency.archived and FK on aqorders.currency
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-03-03 08:42:22 UTC
Size:
1.45 KB
patch
obsolete
>From 407db0917597829f524ada4a7a23c8155e0a1aa6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 29 Oct 2015 14:55:23 +0000 >Subject: [PATCH] Bug 15084: DB Changes - add currency.archived and FK on > aqorders.currency > >See the comment for details. > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../data/mysql/atomicupdate/bug_15084-add_fk_for_currency.sql | 8 ++++++++ > 1 file changed, 8 insertions(+) > create mode 100644 installer/data/mysql/atomicupdate/bug_15084-add_fk_for_currency.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_15084-add_fk_for_currency.sql b/installer/data/mysql/atomicupdate/bug_15084-add_fk_for_currency.sql >new file mode 100644 >index 0000000..d3e00c1 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_15084-add_fk_for_currency.sql >@@ -0,0 +1,8 @@ >+-- Add the new currency.archived column >+alter table currency add column archived tinyint(1) default 0; >+-- Set currency=NULL if empty (just in case) >+update aqorders set currency=NULL where currency=""; >+-- Insert the missing currency and mark them as archived before adding the FK >+insert into currency(currency, archived) select distinct currency, 1 from aqorders where currency not in (select currency from currency); >+-- And finally add the FK >+alter table aqorders add foreign key (currency) references currency(currency) on delete set null on update set null; >-- >2.7.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 15084
:
44162
|
44163
|
44164
|
44165
|
44166
|
44167
|
44168
|
45690
|
45691
|
45692
|
45693
|
45694
|
45695
|
45696
|
45759
|
45761
|
45807
|
45808
|
45809
|
45810
|
45811
|
45812
|
45813
|
45814
|
47213
|
47214
|
47215
|
47216
|
47217
|
47218
|
47219
|
47220
|
47221
|
48594
|
48595
|
48596
|
48597
|
48598
|
48599
| 48600 |
48601
|
48602
|
48603
|
48703
|
48747
|
48772
|
48783
|
48858