Add : upgrade scrip added

This commit is contained in:
Dany De Bontridder 2020-10-11 10:26:47 +02:00
parent fb60db4018
commit 0161cd0d69
4 changed files with 101 additions and 26 deletions

View file

@ -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--');

View file

@ -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);
}
}

View file

@ -0,0 +1,32 @@
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';
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 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;

View file

@ -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;