-- Drop triggers
DROP TRIGGER IF EXISTS trigger_polls_updated_at ON polls;
DROP TRIGGER IF EXISTS trigger_poll_options_updated_at ON poll_options;
DROP FUNCTION IF EXISTS update_polls_updated_at();

-- Drop indexes
DROP INDEX IF EXISTS idx_polls_status;
DROP INDEX IF EXISTS idx_polls_featured;
DROP INDEX IF EXISTS idx_polls_start_date;
DROP INDEX IF EXISTS idx_polls_end_date;
DROP INDEX IF EXISTS idx_polls_deleted_at;

DROP INDEX IF EXISTS idx_poll_options_poll_id;
DROP INDEX IF EXISTS idx_poll_options_display_order;

DROP INDEX IF EXISTS idx_poll_votes_poll_id;
DROP INDEX IF EXISTS idx_poll_votes_option_id;
DROP INDEX IF EXISTS idx_poll_votes_user_id;
DROP INDEX IF EXISTS idx_poll_votes_ip_hash;
DROP INDEX IF EXISTS idx_poll_votes_session_token;

-- Drop tables (in reverse order of dependencies)
DROP TABLE IF EXISTS poll_votes;
DROP TABLE IF EXISTS poll_options;
DROP TABLE IF EXISTS polls;
