Mercurial > gemma
view schema/updates/1426/01.historicise_axis.sql @ 5721:0500d76e074b uploadwg
Fixed eraseObsoleteGaugesSQL by reintroducing matching on users CC.
The condition was removed when introducing file upload, but that leads
to too many gauges being removed.
author | Sascha Wilde <wilde@sha-bang.de> |
---|---|
date | Fri, 19 Apr 2024 16:52:14 +0200 |
parents | e8661379a6c5 |
children |
line wrap: on
line source
ALTER TABLE waterway.waterway_axis ADD validity tstzrange NOT NULL DEFAULT tstzrange(current_timestamp, NULL) CHECK (NOT isempty(validity)), ADD last_found timestamp with time zone NOT NULL DEFAULT current_timestamp; -- Assume existing entries have been valid since last successful import UPDATE waterway.waterway_axis SET validity = tstzrange( (SELECT max(changed) FROM import.imports WHERE kind = 'wx' AND state = CAST('accepted' AS import_state)), NULL); DROP TRIGGER waterway_axis_wtwaxs_unique ON waterway.waterway_axis; CREATE CONSTRAINT TRIGGER waterway_axis_wtwaxs_unique AFTER INSERT OR UPDATE OF wtwaxs, validity ON waterway.waterway_axis FOR EACH ROW EXECUTE FUNCTION prevent_st_equals('wtwaxs', 'validity'); CREATE INDEX waterway_axis_validity ON waterway.waterway_axis USING GiST (validity); -- No more need to delete DROP POLICY responsibility_area_delete ON waterway.waterway_axis;