# How to delete all IP addresses?

**URL:** https://meta.discourse.org/t/how-to-delete-all-ip-addresses/369260
**Category:** Support
**Created:** [June 7, 2025, 8:06pm UTC](https://meta.discourse.org/t/how-to-delete-all-ip-addresses/369260 "2025-06-07T20:06:26Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sallypf](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@sallypf](https://meta.discourse.org/u/sallypf)
#### Post date: [June 7, 2025, 8:06pm UTC](https://meta.discourse.org/t/how-to-delete-all-ip-addresses/369260/1 "2025-06-07T20:06:26Z")

</div>

Is there a way to delete all IP addresses from database? Is there any plugin or any scripts to do that?

Please do not ask why you want to do that, it is jsut requirement and I want to get it done.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 7, 2025, 10:23pm UTC](https://meta.discourse.org/t/how-to-delete-all-ip-addresses/369260/2 "2025-06-07T22:23:36Z")

</div>

I went to [Ask.discourse.com](http://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**
> >
> > Read: [Problematic IP address fields](https://meta.discourse.org/t/problematic-ip-address-fields/83785)
> 
> > **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:
> 
> ```ruby
> 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](https://meta.discourse.org/t/problematic-ip-address-fields/83785)
> 
> 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](mailto:team@discourse.org) for guidance.
> 
> Let me know if you need specific Rails commands for each table or further advice!

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 8, 2025, 7:11am UTC](https://meta.discourse.org/t/how-to-delete-all-ip-addresses/369260/3 "2025-06-08T07:11:32Z")

</div>

> [@pfaffman](#):
>
> - 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)

Interestingly it doesn’t look like it’s included the main ones, `ip_address` and `registration_ip_address` from the users table.

There are a couple of others too when I do a [data explorer](https://meta.discourse.org/t/32566?silent=true) field search.

- `screened_emails.ip_address`
- `screened_urls.ip_address`
- `user_histories.ip_address`
- `user_ip_address_histories.ip_address`

Not all of them have any records in on my test site, but probably worth a check of your own tables to make sure they’re empty for you too.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 8, 2025, 10:16am UTC](https://meta.discourse.org/t/how-to-delete-all-ip-addresses/369260/4 "2025-06-08T10:16:33Z")

</div>

> [@JammyDodger](#):
>
> Interestingly it doesn’t look like it’s included the main ones

Ha! It was the best I could do in my phone. It seemed like a lot so I thought it must have gotten it. 🤣
