nidus-sync/db/migrations/00012_notification_unique_link.sql
Eli Ribble 41587c3694
Move database logic into separate subdirectory
I'm trying to see if this speeds up builds a bit. May not without a
module boundary, but for now it's nice organization to have as the
program grows.
2025-11-24 18:08:31 +00:00

9 lines
307 B
SQL

-- +goose Up
ALTER TABLE notification ADD COLUMN resolved_at TIMESTAMP WITHOUT TIME ZONE;
CREATE UNIQUE INDEX unique_user_link_not_resolved
ON notification (user_id, link)
WHERE resolved_at IS NULL;
-- +goose Down
DROP INDEX unique_user_link_not_resolved;
ALTER TABLE notification DROP COLUMN resolved_at;