Mercurial > gemma
view schema/updates/1101/01.bn_constraint.sql @ 4111:692aba3e8b85 request_hist_bns
Change constraints for bottlenecks to include staging_done flag.
This will allow us to stage not only new bottlenecks but also updates.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Tue, 30 Jul 2019 13:14:47 +0200 |
parents | |
children |
line wrap: on
line source
ALTER TABLE waterway.bottlenecks DROP CONSTRAINT IF EXISTS bottlenecks_bottleneck_id_validity_key, DROP CONSTRAINT IF EXISTS bottlenecks_bottleneck_id_validity_excl, DROP CONSTRAINT IF EXISTS bottlenecks_bottleneck_id_validity_staging_done_key, DROP CONSTRAINT IF EXISTS bottlenecks_bottleneck_id_validity_staging_done_excl; ALTER TABLE waterway.bottlenecks ADD CONSTRAINT bottlenecks_bottleneck_id_validity_staging_done_key UNIQUE (bottleneck_id, validity, staging_done), ADD CONSTRAINT bottlenecks_bottleneck_id_validity_staging_done_excl EXCLUDE USING GiST (bottleneck_id WITH =, validity WITH &&, CAST(staging_done AS int) WITH =) DEFERRABLE INITIALLY DEFERRED;