mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:47:08 +00:00
Remove old QCs when importing final shots.
When final shots are inserted, updated or deleted, the corresponding QC info (which is always held in raw_shots.meta->'qc') is deleted. If applicable, it will be recreated on the next QC run.
This commit is contained in:
@@ -122,6 +122,34 @@ All values are returned as being of type "text" and need casting before use.
|
||||
';
|
||||
|
||||
|
||||
--
|
||||
-- Name: clear_shot_qc(); Type: FUNCTION; Schema: _SURVEY__TEMPLATE_; Owner: postgres
|
||||
--
|
||||
|
||||
CREATE FUNCTION _SURVEY__TEMPLATE_.clear_shot_qc() RETURNS trigger
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
pid text;
|
||||
BEGIN
|
||||
|
||||
-- Bail out early if there are no actual changes
|
||||
IF TG_OP = 'UPDATE' AND NOT (NEW.* IS DISTINCT FROM OLD.*) THEN
|
||||
RETURN NULL;
|
||||
END IF;
|
||||
|
||||
UPDATE raw_shots
|
||||
SET meta = meta #- '{qc}'
|
||||
WHERE (sequence = NEW.sequence OR sequence = OLD.sequence)
|
||||
AND (point = NEW.point OR point = OLD.point);
|
||||
|
||||
RETURN NULL;
|
||||
END;
|
||||
$$;
|
||||
|
||||
|
||||
ALTER FUNCTION _SURVEY__TEMPLATE_.clear_shot_qc() OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: events_timed_seq_match(); Type: FUNCTION; Schema: _SURVEY__TEMPLATE_; Owner: postgres
|
||||
--
|
||||
@@ -1528,6 +1556,13 @@ CREATE TRIGGER events_timed_seq_match_tg AFTER INSERT OR UPDATE ON _SURVEY__TEMP
|
||||
CREATE TRIGGER events_timed_tg BEFORE INSERT OR UPDATE ON _SURVEY__TEMPLATE_.events_timed FOR EACH ROW EXECUTE FUNCTION _SURVEY__TEMPLATE_.assoc_tstamp();
|
||||
|
||||
|
||||
--
|
||||
-- Name: final_shots final_shots_qc_tg; Type: TRIGGER; Schema: _SURVEY__TEMPLATE_; Owner: postgres
|
||||
--
|
||||
|
||||
CREATE TRIGGER final_shots_qc_tg AFTER INSERT OR DELETE OR UPDATE ON _SURVEY__TEMPLATE_.final_shots FOR EACH ROW EXECUTE FUNCTION _SURVEY__TEMPLATE_.clear_shot_qc();
|
||||
|
||||
|
||||
--
|
||||
-- Name: events_seq_labels events_seq_labels_id_fkey; Type: FK CONSTRAINT; Schema: _SURVEY__TEMPLATE_; Owner: postgres
|
||||
--
|
||||
|
||||
Reference in New Issue
Block a user