graphql-engine/server/src-rsr/migrations/45_to_46.sql
Karthikeyan Chinnakonda 2d9959b174 server: add unique constraints to the cron events table (#1131)
GitOrigin-RevId: 3939001a90de041d588c4133ecc1b28b35734d72
2021-04-15 11:21:58 +00:00

8 lines
399 B
SQL

-- This index is added to avoid creating duplicate cron
-- events when multiple Hasura instances are running.
-- This is a partial index for backwards compatibility i.e.
-- the metadata db might already have duplicated events before this change was added.
CREATE UNIQUE INDEX hdb_cron_events_unique_scheduled
ON hdb_catalog.hdb_cron_events (trigger_name, scheduled_time)
WHERE status = 'scheduled';