/**
 * @author tpasquet via sbarthon
 * @date 21/07/21
 * @version 1.0.0
 * @project SIEau Fonto de vivo
 * @table public.MAT_PARAMETRAGES_REGLES
 */

# --- !Ups

CREATE TABLE MAT_PARAMETRAGES_REGLES (
                                         idEquipement bigint,
                                         regleGestion character varying (50),
                                         utilisationRegle boolean,
                                         parametrageRegle character varying (50),
                                         dateMaj timestamp with time zone,
                                         loginMaj character varying (25)
);
delete FROM MAT_PARAMETRAGES;
insert into MAT_PARAMETRAGES values (1,'Centrale',true);
insert into MAT_PARAMETRAGES values (2,'Capteur',true);
insert into MAT_PARAMETRAGES values (3,'Alimentation',true);
insert into MAT_PARAMETRAGES values (4,'Carte SIM',true);
insert into MAT_PARAMETRAGES values (5,'Divers',true);
insert into MAT_PARAMETRAGES values (6,'Télécom',true);
insert into MAT_PARAMETRAGES values (7,'Equipement',true);
insert into MAT_PARAMETRAGES values (8,'Abonnement',true);

insert into MAT_PARAMETRAGES_REGLES values (2,'NUMSERIE_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (2,'DATEACHAT_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (3,'NUMSERIE_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (3,'DATEACHAT_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (4,'NUMSERIE_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (4,'DATEACHAT_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (5,'NUMSERIE_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (5,'DATEACHAT_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (6,'NUMSERIE_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (6,'DATEACHAT_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (7,'NUMSERIE_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (7,'DATEACHAT_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (8,'NUMSERIE_OBLIGATOIRE',true,null,now(),'ADMIN');
insert into MAT_PARAMETRAGES_REGLES values (8,'DATEACHAT_OBLIGATOIRE',true,null,now(),'ADMIN');
ALTER TABLE CONTACTS ADD COLUMN IF NOT EXISTS X real;
ALTER TABLE CONTACTS ADD COLUMN IF NOT EXISTS Y real;
ALTER TABLE CONTACTS ADD COLUMN IF NOT EXISTS typeProjection bigint;
ALTER TABLE INTERVENANTS ADD COLUMN IF NOT EXISTS X real;
ALTER TABLE INTERVENANTS ADD COLUMN IF NOT EXISTS Y real;
ALTER TABLE INTERVENANTS ADD COLUMN IF NOT EXISTS typeProjection bigint;

# --- !Downs