-- 012_telegram_bot_fields.down.sql
--
-- Reverts 012_telegram_bot_fields. Drops the columns added in W3.
-- The original bot_token plaintext column is preserved; the
-- trigger function is dropped because it was added by W3 and has
-- no other consumers.

DROP TRIGGER IF EXISTS trg_telegram_bots_touch_updated_at ON telegram_bots;
DROP FUNCTION IF EXISTS telegram_bots_touch_updated_at();
DROP INDEX IF EXISTS idx_telegram_bots_default_source;

ALTER TABLE telegram_bots
    DROP COLUMN IF EXISTS updated_at,
    DROP COLUMN IF EXISTS last_rotated_at,
    DROP COLUMN IF EXISTS description,
    DROP COLUMN IF EXISTS default_source_id,
    DROP COLUMN IF EXISTS welcome_message,
    DROP COLUMN IF EXISTS bot_token_hash;