Set the DB to the version 202 for NOALYSS9.3

correct make-sql
This commit is contained in:
sparkyx 2024-09-08 18:10:06 +02:00
parent 5b8b3e19dd
commit c540b289dd
7 changed files with 495 additions and 357 deletions

View file

@ -3156,7 +3156,8 @@ COMMENT ON COLUMN public.attr_def.ad_default_order IS 'Default order of the attr
CREATE TABLE public.attr_min (
frd_id integer NOT NULL,
ad_id integer NOT NULL
ad_id integer NOT NULL,
ad_default_order integer
);
@ -4138,6 +4139,7 @@ CREATE TABLE public.jrn_def (
jrn_def_negative_amount character(1) DEFAULT '0'::bpchar NOT NULL,
jrn_def_negative_warning text,
jrn_def_quantity smallint DEFAULT 1 NOT NULL,
jrn_def_pj_padding integer DEFAULT 0,
CONSTRAINT negative_amount_ck CHECK ((jrn_def_negative_amount = ANY (ARRAY['1'::bpchar, '0'::bpchar])))
);
@ -6381,6 +6383,27 @@ COMMENT ON TABLE public.user_sec_jrn IS 'Security on ledger for users';
CREATE TABLE public.user_widget (
uw_id integer NOT NULL,
use_login text NOT NULL,
dashboard_widget_id integer NOT NULL,
uw_parameter text,
uw_order integer
);
ALTER TABLE public.user_widget ALTER COLUMN uw_id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.user_widget_uw_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
CREATE VIEW public.v_all_account_currency AS
SELECT sum(oc.oc_amount) AS sum_oc_amount,
sum(oc.oc_vat_amount) AS sum_oc_vat_amount,
@ -6471,8 +6494,8 @@ CREATE VIEW public.v_contact AS
JOIN public.fiche_def fd ON ((f.fd_id = fd.fd_id)))
WHERE (fd.frd_id = 16)
)
SELECT cd.f_id,
cd.f_enable,
SELECT f_id,
f_enable,
( SELECT fiche_detail.ad_value
FROM public.fiche_detail
WHERE ((fiche_detail.ad_id = 32) AND (fiche_detail.f_id = cd.f_id))) AS contact_fname,
@ -6497,7 +6520,7 @@ CREATE VIEW public.v_contact AS
( SELECT fiche_detail.ad_value
FROM public.fiche_detail
WHERE ((fiche_detail.ad_id = 26) AND (fiche_detail.f_id = cd.f_id))) AS contact_fax,
cd.fd_id AS card_category
fd_id AS card_category
FROM contact_data cd;
@ -6597,10 +6620,10 @@ COMMENT ON VIEW public.vw_fiche_attr IS 'Some attribute for all cards';
CREATE VIEW public.vw_fiche_name AS
SELECT fiche_detail.f_id,
fiche_detail.ad_value AS name
SELECT f_id,
ad_value AS name
FROM public.fiche_detail
WHERE (fiche_detail.ad_id = 1);
WHERE (ad_id = 1);
@ -6950,44 +6973,57 @@ CREATE VIEW public.v_quant_detail AS
0,
quant_sold.qs_vat_sided
FROM public.quant_sold
), sum_jrn AS (
SELECT jrn2.jr_id,
quant2.tiers,
sum(quant2.price) AS price,
quant2.vat_code,
sum(quant2.vat_amount) AS vat_amount,
sum(quant2.dep_priv) AS dep_priv,
sum(quant2.nd_tva) AS nd_tva,
sum(quant2.nd_tva_recup) AS nd_tva_recup,
sum(quant2.nd_amount) AS nd_amount,
sum(quant2.vat_sided) AS vat_sided
FROM ((public.jrn jrn2
JOIN public.jrnx ON ((jrnx.j_grpt = jrn2.jr_grpt_id)))
JOIN quant quant2 USING (j_id))
GROUP BY quant2.tiers, jrn2.jr_id, quant2.vat_code
)
SELECT jrn.jr_id,
quant.tiers,
sum_jrn.tiers,
sum_jrn.price,
sum_jrn.vat_code,
sum_jrn.vat_amount,
sum_jrn.dep_priv,
sum_jrn.nd_tva,
sum_jrn.nd_tva_recup,
sum_jrn.nd_amount,
sum_jrn.vat_sided,
jrn_def.jrn_def_name,
jrn_def.jrn_def_type,
vw_fiche_name.name,
jrn.jr_comment,
jrn.jr_montant,
sum(quant.price) AS price,
quant.vat_code,
sum(quant.vat_amount) AS vat_amount,
sum(quant.dep_priv) AS dep_priv,
sum(quant.nd_tva) AS nd_tva,
sum(quant.nd_tva_recup) AS nd_tva_recup,
sum(quant.nd_amount) AS nd_amount,
quant.vat_sided,
tva_rate.tva_label
FROM (((((public.jrn
JOIN public.jrnx ON ((jrnx.j_grpt = jrn.jr_grpt_id)))
JOIN quant USING (j_id))
LEFT JOIN public.vw_fiche_name ON ((quant.tiers = vw_fiche_name.f_id)))
FROM ((((public.jrn
JOIN sum_jrn ON ((sum_jrn.jr_id = jrn.jr_id)))
LEFT JOIN public.vw_fiche_name ON ((sum_jrn.tiers = vw_fiche_name.f_id)))
JOIN public.jrn_def ON ((jrn_def.jrn_def_id = jrn.jr_def_id)))
JOIN public.tva_rate ON ((tva_rate.tva_id = quant.vat_code)))
GROUP BY jrn.jr_id, quant.tiers, jrn.jr_comment, jrn.jr_montant, quant.vat_code, quant.vat_sided, vw_fiche_name.name, jrn_def.jrn_def_name, jrn_def.jrn_def_type, tva_rate.tva_label;
JOIN public.tva_rate ON ((tva_rate.tva_id = sum_jrn.vat_code)));
CREATE VIEW public.v_tva_rate AS
SELECT tva_rate.tva_id,
tva_rate.tva_rate,
tva_rate.tva_code,
tva_rate.tva_label,
tva_rate.tva_comment,
split_part(tva_rate.tva_poste, ','::text, 1) AS tva_purchase,
split_part(tva_rate.tva_poste, ','::text, 2) AS tva_sale,
tva_rate.tva_both_side,
tva_rate.tva_payment_purchase,
tva_rate.tva_payment_sale
SELECT tva_id,
tva_rate,
tva_code,
tva_label,
tva_comment,
split_part(tva_poste, ','::text, 1) AS tva_purchase,
split_part(tva_poste, ','::text, 2) AS tva_sale,
tva_both_side,
tva_payment_purchase,
tva_payment_sale
FROM public.tva_rate;
@ -7194,6 +7230,47 @@ CREATE VIEW public.vw_supplier AS
CREATE TABLE public.widget_dashboard (
wd_id integer NOT NULL,
wd_code text NOT NULL,
wd_name text NOT NULL,
wd_description text NOT NULL,
wd_parameter integer DEFAULT 0 NOT NULL
);
COMMENT ON COLUMN public.widget_dashboard.wd_id IS 'PK';
COMMENT ON COLUMN public.widget_dashboard.wd_code IS 'Code';
COMMENT ON COLUMN public.widget_dashboard.wd_name IS 'Name';
COMMENT ON COLUMN public.widget_dashboard.wd_description IS 'Description';
COMMENT ON COLUMN public.widget_dashboard.wd_parameter IS 'presence of there is a parameter';
ALTER TABLE public.widget_dashboard ALTER COLUMN wd_id ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME public.widget_dashboard_wd_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
ALTER TABLE ONLY public.acc_other_tax ALTER COLUMN ac_id SET DEFAULT nextval('public.acc_other_tax_ac_id_seq'::regclass);