diff --git a/etc/db/database-version.sql b/etc/db/database-version.sql index dc83582..f9ee035 100644 --- a/etc/db/database-version.sql +++ b/etc/db/database-version.sql @@ -1,5 +1,5 @@ \connect dougal -INSERT INTO public.info VALUES ('version', '{"db_schema": "0.3.12"}') +INSERT INTO public.info VALUES ('version', '{"db_schema": "0.3.13"}') ON CONFLICT (key) DO UPDATE - SET value = public.info.value || '{"db_schema": "0.3.12"}' WHERE public.info.key = 'version'; + SET value = public.info.value || '{"db_schema": "0.3.13"}' WHERE public.info.key = 'version'; diff --git a/etc/db/schema-template.sql b/etc/db/schema-template.sql index 31653d3..bac1969 100644 --- a/etc/db/schema-template.sql +++ b/etc/db/schema-template.sql @@ -671,7 +671,7 @@ BEGIN id <> NEW.id AND label = NEW.label AND id IN (SELECT id FROM events_seq WHERE sequence = _sequence); - + DELETE FROM events_timed_labels WHERE @@ -854,7 +854,7 @@ CREATE FUNCTION _SURVEY__TEMPLATE_.ij_error(line double precision, point double DECLARE bp jsonb := binning_parameters(); ij public.geometry := to_binning_grid(geom, bp); - + theta numeric := (bp->>'theta')::numeric * pi() / 180; I_inc numeric DEFAULT 1; J_inc numeric DEFAULT 1; @@ -869,13 +869,13 @@ DECLARE yoff numeric := (bp->'origin'->>'J')::numeric; E0 numeric := (bp->'origin'->>'easting')::numeric; N0 numeric := (bp->'origin'->>'northing')::numeric; - + error_i double precision; error_j double precision; BEGIN error_i := (public.st_x(ij) - line) * I_width; error_j := (public.st_y(ij) - point) * J_width; - + RETURN public.ST_MakePoint(error_i, error_j); END $$; @@ -1488,9 +1488,9 @@ CREATE VIEW _SURVEY__TEMPLATE_.final_lines_summary AS s.ts1, (s.ts1 - s.ts0) AS duration, s.num_points, - (( SELECT count(*) AS count - FROM _SURVEY__TEMPLATE_.preplot_points - WHERE ((preplot_points.line = fl.line) AND (((preplot_points.point >= s.fsp) AND (preplot_points.point <= s.lsp)) OR ((preplot_points.point >= s.lsp) AND (preplot_points.point <= s.fsp))))) - s.num_points) AS missing_shots, + ( SELECT count(*) AS count + FROM _SURVEY__TEMPLATE_.missing_sequence_final_points + WHERE missing_sequence_final_points.sequence = s.sequence) AS missing_shots, s.length, s.azimuth, fl.remarks, @@ -2137,9 +2137,9 @@ CREATE VIEW _SURVEY__TEMPLATE_.raw_lines_summary AS (s.ts1 - s.ts0) AS duration, s.num_points, s.num_preplots, - (( SELECT count(*) AS count - FROM _SURVEY__TEMPLATE_.preplot_points - WHERE ((preplot_points.line = rl.line) AND (((preplot_points.point >= s.fsp) AND (preplot_points.point <= s.lsp)) OR ((preplot_points.point >= s.lsp) AND (preplot_points.point <= s.fsp))))) - s.num_preplots) AS missing_shots, + (SELECT count(*) AS count + FROM _SURVEY__TEMPLATE_.missing_sequence_raw_points + WHERE missing_sequence_raw_points.sequence = s.sequence) AS missing_shots, s.length, s.azimuth, rl.remarks,