Skip to content

Commit

Permalink
#1139 update sql layers
Browse files Browse the repository at this point in the history
  • Loading branch information
chmnata committed Feb 24, 2025
1 parent f88b452 commit 807ea46
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
17 changes: 16 additions & 1 deletion gis/centreline/sql/create_matview_centreline_latest.sql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,22 @@ WHERE
version_date = (
SELECT MAX(version_date)
FROM gis_core.centreline
);
)
AND feature_code_desc IN (
'Expressway',
'Expressway Ramp',
'Major Arterial',
'Major Arterial Ramp',
'Minor Arterial',
'Minor Arterial Ramp',
'Collector',
'Collector Ramp',
'Local',
'Access Road',
'Other',
'Other Ramp',
'Laneway',
'Pending');

CREATE TRIGGER refresh_trigger
AFTER INSERT OR UPDATE OR DELETE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
CREATE MATERIALIZED VIEW gis_core.centreline_latest_all_feature AS

SELECT *
FROM gis_core.centreline
WHERE
version_date = (
SELECT MAX(version_date)
FROM gis_core.centreline
);


CREATE INDEX gis_core_centreline_latest_all_feature_geom ON gis_core.centreline_latest_all_feature USING gist (geom);

CREATE UNIQUE INDEX centreline_latest_all_feature_unique
ON gis_core.centreline_latest_all_feature USING btree(
centreline_id ASC
);

ALTER MATERIALIZED VIEW gis_core.centreline_latest_all_feature OWNER TO gis_admins;

GRANT SELECT ON gis_core.centreline_latest_all_feature TO bdit_humans, bdit_bots;

COMMENT ON MATERIALIZED VIEW gis_core.centreline_latest_all_feature IS E''
'Materialized view containing the latest version of centreline with all feature code, derived from gis_core.centreline.';
1 change: 1 addition & 0 deletions gis/centreline/sql/create_trigger_centreline_latest.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ AS $BODY$
BEGIN

REFRESH MATERIALIZED VIEW gis_core.centreline_latest;
REFRESH MATERIALIZED VIEW gis_core.centreline_latest_all_feature;
RETURN NULL;

END;
Expand Down

0 comments on commit 807ea46

Please sign in to comment.