Mercurial > gemma
view schema/updates/1426/01.historicise_axis.sql @ 5650:cb3c4ba0f052 DQR adjustments
Merged default branch
author | Sascha Wilde <wilde@sha-bang.de> |
---|---|
date | Thu, 29 Jun 2023 13:18:54 +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;