From 64324cb65d25bf6df89f3c60ef7f5b55cd50e33b Mon Sep 17 00:00:00 2001 From: Emilie Genton Date: Wed, 4 Oct 2023 09:06:23 +0200 Subject: [PATCH] =?UTF-8?q?Ajoute=20un=20flag=20dans=20incoming.HydrantVis?= =?UTF-8?q?ite=20pour=20savoir=20si=20les=20anomalies=20ont=20chang=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ic1c9b598428b0fd0889489a418be126008dddf6a --- .../model/incoming/tables/HydrantVisite.java | 7 +++- .../incoming/tables/pojos/HydrantVisite.java | 18 ++++++++-- .../model/incoming/tables/HydrantVisite.java | 7 +++- .../incoming/tables/pojos/HydrantVisite.java | 17 +++++++-- .../postgres/remocra_db/patches/185/185.sql | 36 +++++++++++++++++++ 5 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 server/sdis-remocra/home/postgres/remocra_db/patches/185/185.sql diff --git a/api-remocra/api/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/HydrantVisite.java b/api-remocra/api/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/HydrantVisite.java index 1556120a9..3f1594899 100644 --- a/api-remocra/api/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/HydrantVisite.java +++ b/api-remocra/api/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/HydrantVisite.java @@ -44,7 +44,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class HydrantVisite extends TableImpl { - private static final long serialVersionUID = 1361842266; + private static final long serialVersionUID = 1876080093; /** * The reference instance of incoming.hydrant_visite @@ -114,6 +114,11 @@ public Class getRecordType() { */ public final TableField OBSERVATIONS_HYDRANT_VISITE = createField("observations_hydrant_visite", org.jooq.impl.SQLDataType.VARCHAR, this, ""); + /** + * The column incoming.hydrant_visite.has_anomalie_changes. + */ + public final TableField HAS_ANOMALIE_CHANGES = createField("has_anomalie_changes", org.jooq.impl.SQLDataType.BOOLEAN.nullable(false).defaultValue(org.jooq.impl.DSL.field("false", org.jooq.impl.SQLDataType.BOOLEAN)), this, ""); + /** * Create a incoming.hydrant_visite table reference */ diff --git a/api-remocra/api/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/pojos/HydrantVisite.java b/api-remocra/api/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/pojos/HydrantVisite.java index 8a505aedb..4fc51c2ee 100644 --- a/api-remocra/api/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/pojos/HydrantVisite.java +++ b/api-remocra/api/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/pojos/HydrantVisite.java @@ -24,7 +24,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class HydrantVisite implements Serializable { - private static final long serialVersionUID = 699532936; + private static final long serialVersionUID = 735209010; private UUID idHydrantVisite; private Long idHydrant; @@ -37,6 +37,7 @@ public class HydrantVisite implements Serializable { private Double pressionHydrantVisite; private Double pressionDynHydrantVisite; private String observationsHydrantVisite; + private Boolean hasAnomalieChanges; public HydrantVisite() {} @@ -52,6 +53,7 @@ public HydrantVisite(HydrantVisite value) { this.pressionHydrantVisite = value.pressionHydrantVisite; this.pressionDynHydrantVisite = value.pressionDynHydrantVisite; this.observationsHydrantVisite = value.observationsHydrantVisite; + this.hasAnomalieChanges = value.hasAnomalieChanges; } public HydrantVisite( @@ -65,7 +67,8 @@ public HydrantVisite( Integer debitHydrantVisite, Double pressionHydrantVisite, Double pressionDynHydrantVisite, - String observationsHydrantVisite + String observationsHydrantVisite, + Boolean hasAnomalieChanges ) { this.idHydrantVisite = idHydrantVisite; this.idHydrant = idHydrant; @@ -78,6 +81,7 @@ public HydrantVisite( this.pressionHydrantVisite = pressionHydrantVisite; this.pressionDynHydrantVisite = pressionDynHydrantVisite; this.observationsHydrantVisite = observationsHydrantVisite; + this.hasAnomalieChanges = hasAnomalieChanges; } public UUID getIdHydrantVisite() { @@ -179,6 +183,15 @@ public HydrantVisite setObservationsHydrantVisite(String observationsHydrantVisi return this; } + public Boolean getHasAnomalieChanges() { + return this.hasAnomalieChanges; + } + + public HydrantVisite setHasAnomalieChanges(Boolean hasAnomalieChanges) { + this.hasAnomalieChanges = hasAnomalieChanges; + return this; + } + @Override public String toString() { StringBuilder sb = new StringBuilder("HydrantVisite ("); @@ -194,6 +207,7 @@ public String toString() { sb.append(", ").append(pressionHydrantVisite); sb.append(", ").append(pressionDynHydrantVisite); sb.append(", ").append(observationsHydrantVisite); + sb.append(", ").append(hasAnomalieChanges); sb.append(")"); return sb.toString(); diff --git a/remocra/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/HydrantVisite.java b/remocra/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/HydrantVisite.java index 04ebaa4d1..23a5e929c 100644 --- a/remocra/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/HydrantVisite.java +++ b/remocra/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/HydrantVisite.java @@ -37,7 +37,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class HydrantVisite extends TableImpl { - private static final long serialVersionUID = 550449527; + private static final long serialVersionUID = 105651387; /** * The reference instance of incoming.hydrant_visite @@ -107,6 +107,11 @@ public Class getRecordType() { */ public final TableField OBSERVATIONS_HYDRANT_VISITE = createField("observations_hydrant_visite", org.jooq.impl.SQLDataType.VARCHAR, this, ""); + /** + * The column incoming.hydrant_visite.has_anomalie_changes. + */ + public final TableField HAS_ANOMALIE_CHANGES = createField("has_anomalie_changes", org.jooq.impl.SQLDataType.BOOLEAN.nullable(false).defaulted(true), this, ""); + /** * Create a incoming.hydrant_visite table reference */ diff --git a/remocra/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/pojos/HydrantVisite.java b/remocra/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/pojos/HydrantVisite.java index 371a150fd..feae0558a 100644 --- a/remocra/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/pojos/HydrantVisite.java +++ b/remocra/src/main/jooq/fr/sdis83/remocra/db/model/incoming/tables/pojos/HydrantVisite.java @@ -25,7 +25,7 @@ @SuppressWarnings({ "all", "unchecked", "rawtypes" }) public class HydrantVisite implements Serializable { - private static final long serialVersionUID = 1635836802; + private static final long serialVersionUID = -1850021608; private UUID idHydrantVisite; private Long idHydrant; @@ -38,6 +38,7 @@ public class HydrantVisite implements Serializable { private Double pressionHydrantVisite; private Double pressionDynHydrantVisite; private String observationsHydrantVisite; + private Boolean hasAnomalieChanges; public HydrantVisite() {} @@ -53,6 +54,7 @@ public HydrantVisite(HydrantVisite value) { this.pressionHydrantVisite = value.pressionHydrantVisite; this.pressionDynHydrantVisite = value.pressionDynHydrantVisite; this.observationsHydrantVisite = value.observationsHydrantVisite; + this.hasAnomalieChanges = value.hasAnomalieChanges; } public HydrantVisite( @@ -66,7 +68,8 @@ public HydrantVisite( Integer debitHydrantVisite, Double pressionHydrantVisite, Double pressionDynHydrantVisite, - String observationsHydrantVisite + String observationsHydrantVisite, + Boolean hasAnomalieChanges ) { this.idHydrantVisite = idHydrantVisite; this.idHydrant = idHydrant; @@ -79,6 +82,7 @@ public HydrantVisite( this.pressionHydrantVisite = pressionHydrantVisite; this.pressionDynHydrantVisite = pressionDynHydrantVisite; this.observationsHydrantVisite = observationsHydrantVisite; + this.hasAnomalieChanges = hasAnomalieChanges; } public UUID getIdHydrantVisite() { @@ -179,4 +183,13 @@ public HydrantVisite setObservationsHydrantVisite(String observationsHydrantVisi this.observationsHydrantVisite = observationsHydrantVisite; return this; } + + public Boolean getHasAnomalieChanges() { + return this.hasAnomalieChanges; + } + + public HydrantVisite setHasAnomalieChanges(Boolean hasAnomalieChanges) { + this.hasAnomalieChanges = hasAnomalieChanges; + return this; + } } diff --git a/server/sdis-remocra/home/postgres/remocra_db/patches/185/185.sql b/server/sdis-remocra/home/postgres/remocra_db/patches/185/185.sql new file mode 100644 index 000000000..43536d892 --- /dev/null +++ b/server/sdis-remocra/home/postgres/remocra_db/patches/185/185.sql @@ -0,0 +1,36 @@ +begin; +set statement_timeout = 0; +set client_encoding = 'UTF8'; +set standard_conforming_strings = off; +set check_function_bodies = false; +set client_min_messages = warning; +set escape_string_warning = off; +set search_path = remocra, pdi, public, pg_catalog; +-------------------------------------------------- +-- Versionnement du patch et vérification +-- +create or replace function versionnement_dffd4df4df() returns void language plpgsql AS $body$ +declare + numero_patch int; + description_patch varchar; +begin + -- Métadonnées du patch + numero_patch := 185; + description_patch := 'Ajoute une colonne dans incoming.hydrantVisite pour spécifier si les anomalies ont changées'; + + -- Vérification + if (select numero_patch-1 != (select max(numero) from remocra.suivi_patches)) then + raise exception 'Le numéro de patch requis n''est pas le bon. Dernier appliqué : %, en cours : %', (select max(numero) from remocra.suivi_patches), numero_patch; end if; + -- Suivi + insert into remocra.suivi_patches(numero, description) values(numero_patch, description_patch); +end $body$; +select versionnement_dffd4df4df(); +drop function versionnement_dffd4df4df(); +-------------------------------------------------- +-- Contenu réel du patch début + +ALTER TABLE incoming.hydrant_visite ADD COLUMN has_anomalie_changes boolean default false not null; + +-- Contenu réel du patch fin +-------------------------------------------------- +COMMIT;