dana-medical-site/internal/storage/migrations/0025_share_links.sql
2026-10-14 13:33:13 +00:00

11 lines
678 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- Ссылка «только просмотр» на дашборд клиники для человека без входа в админку (маркетолога).
-- Одна ссылка на клинику: новый выпуск заменяет старую. В базе — только SHA-256 токена,
-- сам токен показывается один раз при выпуске.
CREATE TABLE share_links (
clinic text PRIMARY KEY,
token_hash text NOT NULL UNIQUE,
admin_id bigint REFERENCES admin_users (id) ON DELETE SET NULL,
created_at timestamptz NOT NULL DEFAULT now(),
last_used_at timestamptz
);