8 lines
434 B
SQL
8 lines
434 B
SQL
-- A disabled row records binding history only. It must not reserve the numeric
|
|
-- Telegram identity forever, otherwise a user who unbinds cannot bind a newly
|
|
-- registered panel account.
|
|
ALTER TABLE telegram_accounts DROP CONSTRAINT IF EXISTS telegram_accounts_telegram_user_id_key;
|
|
CREATE UNIQUE INDEX IF NOT EXISTS telegram_accounts_telegram_user_id_active_idx
|
|
ON telegram_accounts(telegram_user_id)
|
|
WHERE disabled_at IS NULL;
|