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

11 lines
421 B
MySQL
Raw Normal View History

2025-04-23 12:57:10 -07:00
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);