graphql-engine/server/src-rsr/pg_source_migrations/2_to_3.sql
paritosh-08 db710d38b7 server, pro: event trigger auto cleanup (increment 2)
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5746
Co-authored-by: pranshi06 <85474619+pranshi06@users.noreply.github.com>
Co-authored-by: Puru Gupta <32328846+purugupta99@users.noreply.github.com>
Co-authored-by: Karthikeyan Chinnakonda <15602904+codingkarthik@users.noreply.github.com>
GitOrigin-RevId: f4e5e06389ca57bdb5f7771f459c07418787111d
2022-09-13 08:34:52 +00:00

19 lines
556 B
SQL

CREATE TABLE hdb_catalog.hdb_event_log_cleanups
(
id TEXT DEFAULT hdb_catalog.gen_hasura_uuid() PRIMARY KEY,
trigger_name TEXT NOT NULL,
scheduled_at TIMESTAMP NOT NULL,
deleted_event_logs INTEGER,
deleted_event_invocation_logs INTEGER,
status TEXT NOT NULL,
CHECK (status IN ('scheduled', 'paused', 'completed', 'dead')),
UNIQUE (trigger_name, scheduled_at)
);
ALTER TABLE hdb_catalog.event_invocation_logs
ADD COLUMN trigger_name TEXT;
ALTER TABLE hdb_catalog.event_invocation_logs
DROP CONSTRAINT event_invocation_logs_event_id_fkey;