Commit c0b9d150 authored by Rune Åvar Ødegård's avatar Rune Åvar Ødegård
Browse files

Changed verification_flag rules

parent 9138606e
......@@ -4,5 +4,5 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<include file="update_v1.sql" relativeToChangelogFile="true"/>
<include file="update_v2.sql" relativeToChangelogFile="true"/>
</databaseChangeLog>
\ No newline at end of file
INSERT INTO public.eea_times VALUES ('http://dd.eionet.europa.eu/vocabulary/uom/time/second', 'Second', 's');
INSERT INTO public.eea_times VALUES ('http://dd.eionet.europa.eu/vocabulary/aq/primaryObservation/hour', 'Hour', 'h');
INSERT INTO public.eea_times VALUES ('http://dd.eionet.europa.eu/vocabulary/aq/primaryObservation/day', 'Day', 'd');
INSERT INTO public.eea_times VALUES ('http://dd.eionet.europa.eu/vocabulary/aq/primaryObservation/var', 'Variable', 'variable');
ALTER TABLE public.processes
ADD CONSTRAINT processes_cadence_unit_fkey FOREIGN KEY (cadence_unit)
REFERENCES public.eea_times (id) MATCH SIMPLE
......@@ -16,13 +22,6 @@ ALTER TABLE public.observing_capabilities
ON UPDATE CASCADE
ON DELETE CASCADE;
INSERT INTO public.eea_times VALUES ('http://dd.eionet.europa.eu/vocabulary/aq/primaryObservation/hour', 'Hour', 'h');
INSERT INTO public.eea_times VALUES ('http://dd.eionet.europa.eu/vocabulary/aq/primaryObservation/day', 'Day', 'd');
INSERT INTO public.eea_times VALUES ('http://dd.eionet.europa.eu/vocabulary/aq/primaryObservation/var', 'Variable', 'variable');
UPDATE public.eea_timezones SET id = 'http://dd.eionet.europa.eu/vocabulary/aq/timezone/UTC' WHERE id = 'http://dd.eionet.europa.eu/vocabulary/aq/timezone/utc';
UPDATE public.eea_timezones SET id = 'http://dd.eionet.europa.eu/vocabulary/aq/timezone/UTC+01' WHERE id = 'http://dd.eionet.europa.eu/vocabulary/aq/timezone/utc+01';
UPDATE public.eea_timezones SET id = 'http://dd.eionet.europa.eu/vocabulary/aq/timezone/UTC+02' WHERE id = 'http://dd.eionet.europa.eu/vocabulary/aq/timezone/utc+02';
......@@ -40,5 +39,3 @@ UPDATE public.eea_timezones SET id = 'http://dd.eionet.europa.eu/vocabulary/aq/t
CREATE OR REPLACE FUNCTION public.raven_observations_check_verification() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
IF OLD.verification_flag = 1 AND NEW.verification_flag <> 1 AND (OLD.value <> NEW.value OR OLD.validation_flag <> NEW.validation_flag)
THEN
RAISE EXCEPTION 'Cannot change data when verification flag is set to 1 (verified)';
END IF;
RETURN NEW;
END;
$$;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment