/**
 * @author pminot
 * @date 16/03/2022
 * @version 1.0.0
 * @project SIEau
 * @table inst and udi
 */
# --- !Ups
alter table intervenants drop column if exists horairesPublic;
alter table intervenants drop column if exists horaires;
ALTER TABLE intervenants ADD COLUMN horairesPublic TEXT;
ALTER TABLE intervenants ADD COLUMN horaires TEXT;
alter table AEP_UDI drop column if exists longueurEauBrute;
alter table AEP_UDI drop column if exists lineaireHorsBranchement;
alter table AEP_UDI drop column if exists tauxRenouvellementReseauAEP;
alter table AEP_UDI drop column if exists nbBranchements;
alter table AEP_UDI drop column if exists longueurBranchements;
alter table AEP_UDI drop column if exists ageMoyenBranchements;
ALTER TABLE AEP_UDI ADD COLUMN longueurEauBrute REAL;
ALTER TABLE AEP_UDI ADD COLUMN lineaireHorsBranchement REAL;
ALTER TABLE AEP_UDI ADD COLUMN tauxRenouvellementReseauAEP REAL;
ALTER TABLE AEP_UDI ADD COLUMN nbBranchements INTEGER;
ALTER TABLE AEP_UDI ADD COLUMN longueurBranchements REAL;
ALTER TABLE AEP_UDI ADD COLUMN ageMoyenBranchements REAL;
alter table aep_udi_communes drop column if exists adherent;
ALTER TABLE aep_udi_communes ADD COLUMN adherent BOOLEAN;
alter table inst_forages drop column if exists debitPrelevableEssai;
ALTER TABLE inst_forages ADD COLUMN debitPrelevableEssai REAL;
alter table inst_reservoir_gc drop column if exists surface;
ALTER TABLE inst_reservoir_gc ADD COLUMN surface REAL;
alter table INST_ST_POMPAGE_AEP drop column if exists debitNominal;
alter table INST_ST_POMPAGE_AEP drop column if exists volumePotentiel;
alter table INST_ST_POMPAGE_AEP drop column if exists volumePreleve;
ALTER TABLE INST_ST_POMPAGE_AEP ADD COLUMN debitNominal REAL ;
ALTER TABLE INST_ST_POMPAGE_AEP ADD COLUMN volumePotentiel REAL;
ALTER TABLE INST_ST_POMPAGE_AEP ADD COLUMN volumePreleve REAL;
create table aep_reseaux (
                             id BIGINT not null,
                             codeInstallation BIGINT,
                             codeType BIGINT,
                             codeNature BIGINT,
                             codeMatiere BIGINT,
                             longueur REAL
);
create unique index aep_reseaux_idx
    on aep_reseaux (id);
delete from CODES_SANDRE where champ like 'RESEAUX.TYPE' or champ like 'RESEAUX.NATURE' or champ like 'RESEAUX.MATIERE';
INSERT INTO CODES_SANDRE values ('RESEAUX.TYPE',0, 'Inconnu');
INSERT INTO CODES_SANDRE values ('RESEAUX.TYPE',1, 'Eau brute');
INSERT INTO CODES_SANDRE values ('RESEAUX.TYPE',2, 'Eau traitée');
INSERT INTO CODES_SANDRE values ('RESEAUX.NATURE',0,'Inconnu');
INSERT INTO CODES_SANDRE values ('RESEAUX.NATURE',1,'Gravitaire');
INSERT INTO CODES_SANDRE values ('RESEAUX.NATURE',2,'Refoulement distribu');
INSERT INTO CODES_SANDRE values ('RESEAUX.NATURE',3,'Refoulement');
INSERT INTO CODES_SANDRE values ('RESEAUX.MATIERE',0,'Inconnu');
INSERT INTO CODES_SANDRE values ('RESEAUX.MATIERE',1,'Acier');
INSERT INTO CODES_SANDRE values ('RESEAUX.MATIERE',2,'Amiante Ciment');
INSERT INTO CODES_SANDRE values ('RESEAUX.MATIERE',3,'Fonte');
INSERT INTO CODES_SANDRE values ('RESEAUX.MATIERE',4,'PEHD');
INSERT INTO CODES_SANDRE values ('RESEAUX.MATIERE',5,'PVC');
INSERT INTO CODES_SANDRE values ('RESEAUX.MATIERE',6,'Autre');
# --- !Downs