-- Upgrade the database from commit 4d977848 to 3d70a460. -- -- NOTE: This upgrade must be applied to every schema in the database. -- NOTE: Each application starts a transaction, which must be committed -- or rolled back. -- -- This adds the `meta` column to the output of the following views: -- -- * raw_lines_summary; and -- * sequences_summary -- -- To apply, run as the dougal user, for every schema in the database: -- -- psql <= 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, s.length, s.azimuth, rl.remarks, rl.ntbp, rl.meta FROM (summary s JOIN raw_lines rl USING (sequence)); DROP VIEW sequences_summary; CREATE OR REPLACE VIEW sequences_summary AS SELECT rls.sequence, rls.line, rls.fsp, rls.lsp, fls.fsp AS fsp_final, fls.lsp AS lsp_final, rls.ts0, rls.ts1, fls.ts0 AS ts0_final, fls.ts1 AS ts1_final, rls.duration, fls.duration AS duration_final, rls.num_preplots, COALESCE(fls.num_points, rls.num_points) AS num_points, COALESCE(fls.missing_shots, rls.missing_shots) AS missing_shots, COALESCE(fls.length, rls.length) AS length, COALESCE(fls.azimuth, rls.azimuth) AS azimuth, rls.remarks, fls.remarks AS remarks_final, rls.meta, fls.meta AS meta_final, CASE WHEN (rls.ntbp IS TRUE) THEN 'ntbp'::text WHEN (fls.sequence IS NULL) THEN 'raw'::text ELSE 'final'::text END AS status FROM (raw_lines_summary rls LEFT JOIN final_lines_summary fls USING (sequence)); -- --NOTE Run `COMMIT;` now if all went well --