noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 76/119: Add : upgrade scrip added


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 76/119: Add : upgrade scrip added
Date: Mon, 26 Oct 2020 18:27:27 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0161cd0d6930dd06cd2494a7e6b534bcf2485664
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Sun Oct 11 10:26:47 2020 +0200

    Add : upgrade scrip added
---
 include/constant.php                               |  2 +-
 include/database/attr_def_sql.class.php            | 68 ++++++++++++++++++++++
 .../sql/patch/upgrade145.sql                       | 11 +++-
 sql/upgrade.sql                                    | 25 --------
 4 files changed, 78 insertions(+), 28 deletions(-)

diff --git a/include/constant.php b/include/constant.php
index c6c0d23..b8d723d 100644
--- a/include/constant.php
+++ b/include/constant.php
@@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) {
 if ( ! defined ("SYSINFO_DISPLAY")) {
     define ("SYSINFO_DISPLAY",TRUE);
 }
-define ("DBVERSION",145);
+define ("DBVERSION",146);
 define ("MONO_DATABASE",25);
 define ("DBVERSIONREPO",18);
 define ('NOTFOUND','--not found--');
diff --git a/include/database/attr_def_sql.class.php 
b/include/database/attr_def_sql.class.php
new file mode 100644
index 0000000..450a120
--- /dev/null
+++ b/include/database/attr_def_sql.class.php
@@ -0,0 +1,68 @@
+<?php
+
+/**
+ * Autogenerated file 
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   NOALYSS is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php';
+require_once NOALYSS_INCLUDE.'/class/database.class.php';
+
+/**
+ * class_attr_def_sql.php
+ *
+ * @file
+ * @brief abstract of the table public.attr_def */
+class Attr_def_SQL extends Noalyss_SQL
+{
+
+    function __construct(Database $p_cn, $p_id=-1)
+    {
+        $this->table="public.attr_def";
+        $this->primary_key="ad_id";
+        /*
+         * List of columns
+         */
+        $this->name=array(
+            "id"=>"ad_id"
+            , "desc"=>"ad_text"
+            , "type"=>"ad_type"
+            , "size"=>"ad_size"
+            , "extra"=>"ad_extra"
+            , "search_followup"=>"ad_search_followup"
+        );
+        /*
+         * Type of columns
+         */
+        $this->type=array(
+            "ad_id"=>"numeric"
+            , "ad_text"=>"text"
+            , "ad_type"=>"text"
+            , "ad_size"=>"text"
+            , "ad_extra"=>"text"
+            , "ad_search_followup"=>"numeric"
+        );
+
+
+        $this->default=array(
+            "ad_id"=>"auto"
+        );
+
+        $this->date_format="DD.MM.YYYY";
+        parent::__construct($p_cn, $p_id);
+    }
+
+}
diff --git a/sql/upgrade.sql b/include/sql/patch/upgrade145.sql
similarity index 83%
copy from sql/upgrade.sql
copy to include/sql/patch/upgrade145.sql
index 4d158dd..98b6fff 100644
--- a/sql/upgrade.sql
+++ b/include/sql/patch/upgrade145.sql
@@ -1,10 +1,12 @@
+begin;
+
 ALTER TABLE public.document_option ADD do_option varchar NULL;
 COMMENT ON COLUMN public.document_option.do_option IS 'Option for the detail';
 
 alter table attr_def add column ad_search_followup int;
 alter table attr_def alter column ad_search_followup set default 1;
 update attr_def set ad_search_followup=1;
-comment on column attr_def.ad_search_followup is '1 : search  available  from 
followup , 0  : search not available in followup'
+comment on column attr_def.ad_search_followup is '1 : search  available  from 
followup , 0  : search not available in followup';
 
 
 create table jnt_document_option_contact
@@ -20,6 +22,11 @@ ALTER TABLE public.jnt_document_option_contact ADD 
CONSTRAINT jnt_document_optio
 insert into attr_def(ad_id,ad_text,ad_type,ad_size) values 
(54,'Actif','check','1');
 insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ;
 insert into jnt_fic_attr  (fd_id,ad_id,jnt_order) select fd_id,54,30 from 
fiche_def;
-insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from 
fiche_detail where ad_id=1;
+insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from 
fiche_detail where ad_id=1 and f_id not in (select f_id from fiche_detail where 
ad_id=54);
 insert into menu_ref(me_code,me_menu,me_file,me_type) values 
('CSV:FollowUpContactOption','Export action 
suivi','export_follow_up_contact_csv.php','PR');
 insert into profile_menu (me_code,p_id,p_type_display) select 
'CSV:FollowUpContactOption',p_id,'P' from profile;
+
+
+
+insert into version (val,v_description) values (146,'Export CSV for Multiple 
card, contact option by document type');
+commit;
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 4d158dd..e69de29 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -1,25 +0,0 @@
-ALTER TABLE public.document_option ADD do_option varchar NULL;
-COMMENT ON COLUMN public.document_option.do_option IS 'Option for the detail';
-
-alter table attr_def add column ad_search_followup int;
-alter table attr_def alter column ad_search_followup set default 1;
-update attr_def set ad_search_followup=1;
-comment on column attr_def.ad_search_followup is '1 : search  available  from 
followup , 0  : search not available in followup'
-
-
-create table jnt_document_option_contact
-(
-jdoc_id bigserial primary key,
-jdoc_enable int not null, 
-document_type_id bigint references document_type (dt_id) on delete cascade on 
update cascade,
-contact_option_ref_id bigint references contact_option_ref(cor_id) on delete 
cascade  on update  cascade
-);
-ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT 
jnt_document_option_contact_un UNIQUE (document_type_id,contact_option_ref_id);
-ALTER TABLE public.jnt_document_option_contact ADD CONSTRAINT 
jnt_document_option_contact_check CHECK (jdoc_enable in (0,1));
-
-insert into attr_def(ad_id,ad_text,ad_type,ad_size) values 
(54,'Actif','check','1');
-insert into attr_min(frd_id,ad_id) select frd_id , 54 from fiche_def_ref ;
-insert into jnt_fic_attr  (fd_id,ad_id,jnt_order) select fd_id,54,30 from 
fiche_def;
-insert into fiche_detail (f_id,ad_id,ad_value) select f_id, 54,1 from 
fiche_detail where ad_id=1;
-insert into menu_ref(me_code,me_menu,me_file,me_type) values 
('CSV:FollowUpContactOption','Export action 
suivi','export_follow_up_contact_csv.php','PR');
-insert into profile_menu (me_code,p_id,p_type_display) select 
'CSV:FollowUpContactOption',p_id,'P' from profile;



reply via email to

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