view schema/updates/1204/01.create-iso-areas.sql @ 5560:f2204f91d286

Join the log lines of imports to the log exports to recover data from them. Used in SR export to extract information that where in the meta json but now are only found in the log.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 09 Feb 2022 18:34:40 +0100
parents 26e9846ed69f
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;