shoutdotdev/migrations/2025-04-22-053211_watchdogs/up.sql

10 lines
421 B
SQL

CREATE TABLE IF NOT EXISTS watchdogs (
id UUID PRIMARY KEY NOT NULL,
project_id UUID UNIQUE NOT NULL REFERENCES projects (id) ON DELETE RESTRICT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
last_set_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
expiration TIMESTAMPTZ NOT NULL,
notified BOOLEAN NOT NULL DEFAULT FALSE
);
CREATE INDEX ON watchdogs (project_id);
CREATE INDEX ON watchdogs (expiration);