noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 09/17: FInal : add SQL upgrade script + test


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 09/17: FInal : add SQL upgrade script + test
Date: Tue, 16 May 2023 14:50:12 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0eaf7eb8365fefb10f1fb4f690fe0dbabe438053
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sun Apr 30 19:09:26 2023 +0200

    FInal : add SQL upgrade script + test
---
 include/constant.php                               |  2 +-
 .../sql/patch/upgrade184.sql                       |  4 ++
 sql/upgrade.sql                                    | 46 ----------------------
 unit-test/create-dossier-test.sh                   |  4 +-
 ...edger_sale.Test.php => acc_ledger_saleTest.php} |  0
 5 files changed, 7 insertions(+), 49 deletions(-)

diff --git a/include/constant.php b/include/constant.php
index 6cc75512c..4e258c43a 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -116,7 +116,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) {
 if (!defined("SYSINFO_DISPLAY")) {
     define("SYSINFO_DISPLAY", TRUE);
 }
-define("DBVERSION", 184);
+define("DBVERSION", 185);
 define("MONO_DATABASE", 25);
 define("DBVERSIONREPO", 20);
 define('NOTFOUND', '--not found--');
diff --git a/sql/upgrade.sql b/include/sql/patch/upgrade184.sql
similarity index 93%
copy from sql/upgrade.sql
copy to include/sql/patch/upgrade184.sql
index d167abe17..9f4028126 100644
--- a/sql/upgrade.sql
+++ b/include/sql/patch/upgrade184.sql
@@ -1,3 +1,5 @@
+begin;
+
 update menu_ref set me_menu='Journal' where me_code='CFGLED';
 
 CREATE OR REPLACE FUNCTION comptaproc.four_upper_letter()
@@ -44,3 +46,5 @@ INSERT INTO document_component (dc_comment, dc_code) 
VALUES('Gestion', 'GES');
 
 ALTER TABLE public.document_modele ADD CONSTRAINT document_modele_fk FOREIGN 
KEY (md_affect) REFERENCES public.document_component(dc_code) ON UPDATE CASCADE;
 
+insert into version (val,v_description) values (185,'Document Component : Type 
of Document Model in a table');
+commit;
\ No newline at end of file
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index d167abe17..e69de29bb 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -1,46 +0,0 @@
-update menu_ref set me_menu='Journal' where me_code='CFGLED';
-
-CREATE OR REPLACE FUNCTION comptaproc.four_upper_letter()
-    RETURNS trigger
-AS $function$
-begin
-    new.dc_code=transform_to_code(new.dc_code);
-    new.dc_code:=substr(new.dc_code,1,4);
-    return new;
-END;
-$function$
-LANGUAGE plpgsql;
-
-COMMENT ON FUNCTION comptaproc.four_upper_letter() IS 'Cut to the 4 first 
letter in uppercase';
-
-
-DROP TABLE if exists document_component ;
-
-CREATE TABLE document_component (
-                                    dc_id int4 NOT NULL GENERATED BY DEFAULT 
AS IDENTITY, -- PK
-                                    dc_code text NOT NULL, -- Code used in 
document_modele
-                                    dc_comment text not null , -- description
-                                    CONSTRAINT document_component_pk PRIMARY 
KEY (dc_id),
-                                    CONSTRAINT document_component_un UNIQUE 
(dc_code)
-);
-COMMENT ON TABLE public.document_component IS 'Give the component of NOALYSS 
that is using is';
-
--- Column comments
-
-COMMENT ON COLUMN public.document_component.dc_id IS 'PK';
-COMMENT ON COLUMN public.document_component.dc_code IS 'Code used in 
document_modele';
-COMMENT ON COLUMN public.document_component.dc_comment IS 'Code used in 
document_modele';
-
--- Table Triggers
-
-create trigger t_code before insert
-    or update on
-    public.document_component for each row execute function 
comptaproc.four_upper_letter();
-
-
-INSERT INTO document_component (dc_comment, dc_code) VALUES('Journaux achat', 
'ACH');
-INSERT INTO document_component (dc_comment, dc_code) VALUES('Journaux vente', 
'VEN');
-INSERT INTO document_component (dc_comment, dc_code) VALUES('Gestion', 'GES');
-
-ALTER TABLE public.document_modele ADD CONSTRAINT document_modele_fk FOREIGN 
KEY (md_affect) REFERENCES public.document_component(dc_code) ON UPDATE CASCADE;
-
diff --git a/unit-test/create-dossier-test.sh b/unit-test/create-dossier-test.sh
index 3360797a9..fb5a27541 100755
--- a/unit-test/create-dossier-test.sh
+++ b/unit-test/create-dossier-test.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 
-export PGCLUSTER=10/main
-DOSSIER_TEST=rel70dossier25
+export PGCLUSTER=12/main
+DOSSIER_TEST=rel91dossier25
 FILE_TEST=dossier25.sql
 
 dropdb $DOSSIER_TEST
diff --git a/unit-test/include/class/acc_ledger_sale.Test.php 
b/unit-test/include/class/acc_ledger_saleTest.php
similarity index 100%
rename from unit-test/include/class/acc_ledger_sale.Test.php
rename to unit-test/include/class/acc_ledger_saleTest.php



reply via email to

[Prev in Thread] Current Thread [Next in Thread]