From c2c220ec5586fb5d8b8cfbe59266e77990bbfd8c Mon Sep 17 00:00:00 2001 From: Joaquim Nallar Date: Mon, 14 Oct 2024 11:37:53 +0200 Subject: [PATCH] fix: migration script to update vm_observations_mailles --- data/update/update_1.6.1to1.6.2.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/data/update/update_1.6.1to1.6.2.sql b/data/update/update_1.6.1to1.6.2.sql index c2a20a1e4..237a47602 100644 --- a/data/update/update_1.6.1to1.6.2.sql +++ b/data/update/update_1.6.1to1.6.2.sql @@ -27,7 +27,8 @@ CREATE MATERIALIZED VIEW atlas.vm_observations_mailles AS o.cd_ref, date_part('year', o.dateobs) AS annee, m.id_maille, - COUNT(o.id_observation) AS nbr + COUNT(o.id_observation) AS nbr, + ARRAY_AGG(o.id_observation) AS id_observations FROM atlas.vm_observations AS o JOIN atlas.t_mailles_territoire AS m ON (o.the_geom_point && m.the_geom) @@ -41,6 +42,9 @@ CREATE UNIQUE INDEX ON atlas.vm_observations_mailles CREATE INDEX ON atlas.vm_observations_mailles USING btree (annee); +CREATE INDEX ON atlas.vm_observations_mailles + USING gin (id_observations); + CREATE INDEX ON atlas.vm_observations_mailles USING btree (id_maille, cd_ref);