-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathlogs_create_scan_status.sql
More file actions
27 lines (22 loc) · 1.67 KB
/
logs_create_scan_status.sql
File metadata and controls
27 lines (22 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- Deploy travis-logs:logs_create_scan_status to pg
-- requires: partman_remove_constraint
BEGIN;
SET client_min_messages = WARNING;
ALTER TABLE logs
ADD COLUMN scan_status character varying,
ADD COLUMN scan_status_updated_at timestamp without time zone,
ADD COLUMN censored boolean,
ADD COLUMN scan_queued_at timestamp without time zone,
ADD COLUMN scan_started_at timestamp without time zone,
ADD COLUMN scan_processing_at timestamp without time zone,
ADD COLUMN scan_finalizing_at timestamp without time zone,
ADD COLUMN scan_ended_at timestamp without time zone;
CREATE INDEX IF NOT EXISTS index_logs_on_scan_status_order_by_newest ON public.logs USING btree (scan_status, id DESC);
CREATE INDEX IF NOT EXISTS index_logs_on_scan_status_and_scan_status_updated_at ON public.logs USING btree (scan_status, scan_status_updated_at);
-- CREATE INDEX IF NOT EXISTS index_logs_on_scan_status_and_scan_status_updated_at_where_running ON public.logs USING btree (scan_status, scan_status_updated_at) WHERE ((scan_status)::text = ANY ((ARRAY['started'::character varying, 'processing'::character varying, 'finalizing'::character varying])::text[]));
CREATE INDEX IF NOT EXISTS index_logs_on_scan_queued_at ON public.logs USING btree (scan_queued_at);
CREATE INDEX IF NOT EXISTS index_logs_on_scan_started_at ON public.logs USING btree (scan_started_at);
CREATE INDEX IF NOT EXISTS index_logs_on_scan_processing_at ON public.logs USING btree (scan_processing_at);
CREATE INDEX IF NOT EXISTS index_logs_on_scan_finalizing_at ON public.logs USING btree (scan_finalizing_at);
CREATE INDEX IF NOT EXISTS index_logs_on_scan_ended_at ON public.logs USING btree (scan_ended_at);
COMMIT;