view schema/updates/1204/01.create-iso-areas.sql @ 4573:26e9846ed69f iso-areas

Added caching table for iso areas of sounding differences.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 07 Oct 2019 12:37:17 +0200
parents 2c49a293f275
children
line wrap: on
line source

CREATE TABLE waterway.sounding_results_iso_areas (
    sounding_result_id int NOT NULL REFERENCES waterway.sounding_results
        ON DELETE CASCADE,
    height numeric NOT NULL,
    areas geography(MULTIPOLYGON, 4326) NOT NULL,
    -- TODO: generate valid simple features and add constraint:
        -- CHECK(ST_IsSimple(CAST(areas AS geometry))),
    PRIMARY KEY (sounding_result_id, height)
);

CREATE TABLE caching.sounding_differences_iso_areas (
    sounding_differences_id int NOT NULL REFERENCES caching.sounding_differences(id)
                                ON DELETE CASCADE,
    height numeric NOT NULL,
    areas  geography(MULTIPOLYGON, 4326) NOT NULL,
    PRIMARY KEY (sounding_differences_id, height)
);

GRANT INSERT, UPDATE, DELETE ON waterway.sounding_results_iso_areas
    TO waterway_admin;

GRANT SELECT ON waterway.sounding_results_iso_areas
    TO waterway_user;

GRANT SELECT, UPDATE, DELETE, INSERT ON caching.sounding_differences_iso_areas
    TO waterway_user;