[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 32/218: Task #448 : SQL integrated into upgra
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 32/218: Task #448 : SQL integrated into upgrade128 |
Date: |
Thu, 12 Sep 2019 15:58:35 -0400 (EDT) |
sparkyx pushed a commit to branch entreprise
in repository noalyss.
commit a9c547c3ca6eb35a24797fdfa2d48d8d91c11180
Author: Dany De Bontridder <address@hidden>
Date: Sat May 12 10:49:03 2018 +0200
Task #448 : SQL integrated into upgrade128
---
sql/upgrade.sql | 100 --------------------------------------------------------
1 file changed, 100 deletions(-)
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 73bbfe57..e69de29 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -1,100 +0,0 @@
-INSERT INTO public.menu_ref
-(me_code, me_menu, me_file, me_url, me_description, me_parameter,
me_javascript, me_type, me_description_etendue)
-VALUES('CFGCURRENCY', 'Devises', 'acc_currency_cfg.inc.php', NULL,
'Configuration des devises', NULL,NULL,'ME','Permet de configurer les devises');
-
-INSERT INTO public.profile_menu
-(pm_id, me_code, me_code_dep, p_id, p_order, p_type_display, pm_default,
pm_id_dep)
-VALUES(nextval('profile_menu_pm_id_seq'), 'CFGCURRENCY', 'PARAM', 1, 50, 'E',
0, 45);
-
--- Drop table
-
--- DROP TABLE public.currency
-
-CREATE TABLE public.currency (
- id serial NOT NULL,
- cr_code_iso varchar(10) NULL,
- CONSTRAINT currency_pk PRIMARY KEY (id),
- CONSTRAINT currency_un UNIQUE (cr_code_iso)
-);
-
-
--- Drop table
-
--- DROP TABLE public.currency_history
-
-CREATE TABLE public.currency_history (
- id serial NOT NULL,
- ch_value numeric(20,6) NOT NULL,
- ch_from date NOT NULL,
- currency_id int4 NOT NULL,
- CONSTRAINT currency_history_pk PRIMARY KEY (id),
- CONSTRAINT currency_history_currency_fk FOREIGN KEY (currency_id)
REFERENCES currency(id)
- ON DELETE RESTRICT ON UPDATE CASCADE
-)
-;
-
--- Ajouter commentaire sur colonne
-
-ALTER TABLE public.currency ADD cr_name varchar(80) NULL;
-insert into currency (id,cr_code_iso,cr_name) values (-1,'EUR','EUR');
-insert into currency_history (ch_value,ch_from,currency_id) values
(1,to_date('01.01.2000','DD.MM.YYYY'),-1);
-
-ALTER TABLE public.currency_history ADD CONSTRAINT currency_history_check
CHECK (ch_value > 0) ;
-
--- Create view to manage the table
-create view v_currency_last_value as
-with recent_rate as
-( select
- currency_id,max(ch_from) as rc_from
- from
- currency_history
- group by currency_id
- )
-select
- cr1.id as currency_id,
- cr1.cr_name,
- cr1.cr_code_iso,
- ch1.id as currency_history_id,
- ch1.ch_value as ch_value,
- to_char(rc_from,'DD.MM.YYYY') as str_from
-from
-currency as cr1
-join recent_rate on (currency_id=cr1.id)
-join currency_history as ch1 on (recent_rate.currency_id=ch1.currency_id and
rc_from=ch1.ch_from);
-
-COMMENT ON COLUMN public.currency_history.id IS 'pk' ;
-COMMENT ON COLUMN public.currency_history.ch_value IS 'rate of currency
depending of currency of the folder' ;
-COMMENT ON COLUMN public.currency_history.ch_from IS 'Date when the rate is
available' ;
-COMMENT ON COLUMN public.currency_history.currency_id IS 'FK to currency' ;
-COMMENT ON COLUMN public.currency.cr_code_iso IS 'Code ISO' ;
-COMMENT ON COLUMN public.currency.cr_name IS 'Name of the currency' ;
-
-
-insert into "parameter" values ('MY_CURRENCY','N');
-
--- Drop table
-
--- DROP TABLE public.operation_currency
-
-CREATE TABLE public.operation_currency (
- id bigserial NOT NULL,
- oc_amount numeric(6) NOT NULL, -- amount in currency
- oc_vat_amount numeric(6) NULL DEFAULT 0, -- vat amount in currency
- oc_price_unit numeric(6) NULL, -- unit price in currency
- j_id int8 NOT NULL, -- fk to jrnx
- CONSTRAINT operation_currency_pk PRIMARY KEY (id)
-);
-
-ALTER TABLE public.operation_currency ADD CONSTRAINT
operation_currency_jrnx_fk FOREIGN KEY (j_id) REFERENCES public.jrnx(j_id) ON
DELETE CASCADE ON UPDATE CASCADE;
-
--- Column comments
-
-COMMENT ON COLUMN public.operation_currency.oc_amount IS 'amount in currency' ;
-COMMENT ON COLUMN public.operation_currency.oc_vat_amount IS 'vat amount in
currency' ;
-COMMENT ON COLUMN public.operation_currency.oc_price_unit IS 'unit price in
currency' ;
-COMMENT ON COLUMN public.operation_currency.j_id IS 'fk to jrnx' ;
-
-alter table jrn add currency_id bigint default 0;
-alter table jrn add currency_rate numeric (20,6) default 1;
-alter table jrn add currency_rate_ref numeric(20,6) default 1;
-ALTER TABLE public.jrn ADD CONSTRAINT jrn_currency_fk FOREIGN KEY
(currency_id) REFERENCES public.currency(id) ON DELETE RESTRICT ON UPDATE
RESTRICT;
- [Noalyss-commit] [noalyss] 31/218: task #448 : currency always used and remove parameter 'use_currency' from parameters, add SQL script, (continued)
- [Noalyss-commit] [noalyss] 31/218: task #448 : currency always used and remove parameter 'use_currency' from parameters, add SQL script, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 38/218: Task #448 : currency improve detail of operation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 09/218: Currency : add security for setting, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 13/218: indent, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 17/218: Currency : fix rounded bugs in detail operation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 18/218: task #448 : Currency : display currency info into operation detail, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 20/218: Task #448 : check currency rate > 0 and payment in eur, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 23/218: Display the balance difference, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 25/218: Task #448 : payment method VEN, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 30/218: remove debug info, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 32/218: Task #448 : SQL integrated into upgrade128,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 35/218: Task #448 : correct bug when saving into quant_purchase, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 36/218: Bug in QUANT_PURCHASE , dp_dep_priv is not saved, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 42/218: remove debug, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 55/218: integrate fix for bug in insert_quant_purchase which cannot save private fee Conflicts: include/sql/patch/upgrade128.sql, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 29/218: Task #448 : currency_id = 0 for the default currency + display currency rate in confirm operation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 34/218: Task #448 : Currency : purchase, fix bug for autoreverse VAT, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 40/218: Fix bug quant_purchase , private fee not saved, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 45/218: Fix todo_list : if list empty , gets an error in php 7.2, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 49/218: Update documentation, Dany De Bontridder, 2019/09/12
- [Noalyss-commit] [noalyss] 54/218: Bug 1600 : alphanumeric accounting must be case insensitive, Dany De Bontridder, 2019/09/12