owpengram-server/deploy/migrations/20260714003072_bot_api_poll_lease.up.sql
2026-07-21 00:18:12 +03:00

10 lines
376 B
SQL

ALTER TABLE public.bot_api_update_states
ADD COLUMN poll_owner text NOT NULL DEFAULT '',
ADD COLUMN poll_expires_at timestamptz;
ALTER TABLE public.bot_api_update_states
ADD CONSTRAINT bot_api_update_states_poll_lease_check CHECK (
(poll_owner = '' AND poll_expires_at IS NULL)
OR
(poll_owner <> '' AND poll_expires_at IS NOT NULL)
);