-- +goose Up -- Heartbeat monitors are pinged by the monitored job instead of being -- checked. Their target is the secret token of the ping URL. ALTER TABLE monitors DROP CONSTRAINT monitors_type_check; ALTER TABLE monitors ADD CONSTRAINT monitors_type_check CHECK (type IN ('http', 'tcp', 'icmp', 'dns', 'tls', 'heartbeat')); CREATE UNIQUE INDEX monitors_heartbeat_token_idx ON monitors (target) WHERE type = 'heartbeat'; -- +goose Down DROP INDEX monitors_heartbeat_token_idx; DELETE FROM monitors WHERE type = 'heartbeat'; ALTER TABLE monitors DROP CONSTRAINT monitors_type_check; ALTER TABLE monitors ADD CONSTRAINT monitors_type_check CHECK (type IN ('http', 'tcp', 'icmp', 'dns', 'tls'));