I went to Ask.discourse.com and got this, which seems probably true.
Deleting IP Addresses in Discourse with Rails AI
pfaffman:
Where are ip addresses stored. Can I delete them all from rails?
DiscourseHelper:
Searching
Searching for: Where are user and post IP addresses stored in the Discourse database, and is it possible to delete all stored IP addresses using Rails or through a rake task for privacy or GDPR compliance?
Reading
Look up database schema
incoming_links,search_logs,topic_link_clicks,topic_views,user_profile_views,user_auth_tokens,user_auth_token_logs,screened_ip_addresses
Discourse stores IP addresses in several database tables, specifically:
- incoming_links (ip_address)
- search_logs (ip_address)
- topic_link_clicks (ip_address)
- topic_views (ip_address)
- user_profile_views (ip_address)
- user_auth_tokens (client_ip)
- user_auth_token_logs (client_ip)
- screened_ip_addresses (ip_address)
You can delete IP addresses using Rails commands if you have terminal access (self-hosted installations). For each table, you can set the relevant column (like ip_address or client_ip) to NULL. Example for incoming_links:
IncomingLink.update_all(ip_address: nil)
You would run similar commands for each relevant table/column.
For more details and context about privacy and potential implications, see this discussion:
Problematic IP address fields
Note: If you’re on Discourse’s hosted service, you do not have SSH or Rails console access; in such cases, contact Discourse support at team@discourse.org for guidance.
Let me know if you need specific Rails commands for each table or further advice!