# האם יש דרך להסיר את כל התיקונים למוצרים所有 הפוסטים?

**URL:** https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001
**Category:** Support
**Created:** [13 בספטמבר,‏ 2017,‏ 8:02pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001 "2017-09-13T20:02:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Morfik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/morfik/32/120704_2.png) [@Morfik](https://meta.discourse.org/u/Morfik)
#### Post date: [13 בספטמבר,‏ 2017,‏ 8:02pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001/1 "2017-09-13T20:02:29Z")

</div>

I’ve been editing posts on my board, mainly in order to fix weird post formating after importing the old database and also to convert links to oneboxes – it needed a little work, but it’s done now.

The problem is that many posts now have 2-5 revisions, which makes the database larger. The posts revisions could be safely removed because I obviously don’t need them, at least these ones.

So is there a way to remove all the post revisions somehow?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [13 בספטמבר,‏ 2017,‏ 8:08pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001/2 "2017-09-13T20:08:25Z")

</div>

> [@Morfik](#):
>
> The problem is that many posts now have 2-5 revisions, which makes the database larger.

I would not worry about that.

An image would be worth 100s (if not 1000s) of post revisions storage-wise.

---

<div class="post-metadata">

### Author: ![Morfik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/morfik/32/120704_2.png) [@Morfik](https://meta.discourse.org/u/Morfik)
#### Post date: [13 בספטמבר,‏ 2017,‏ 8:20pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001/3 "2017-09-13T20:20:22Z")

</div>

Hmm, but is there a way to remove them all? I’m just curious 😃

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [13 בספטמבר,‏ 2017,‏ 8:23pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001/4 "2017-09-13T20:23:13Z")

</div>

If you know SQL, then it’s two queries away

- delete everything in the `post_revisions` table
- update `version` and `public_version` on the `posts` table to 1

😉

---

<div class="post-metadata">

### Author: ![Morfik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/morfik/32/120704_2.png) [@Morfik](https://meta.discourse.org/u/Morfik)
#### Post date: [13 בספטמבר,‏ 2017,‏ 8:26pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001/5 "2017-09-13T20:26:24Z")

</div>

I think that’s the solution I’ve been looking for. 🙂 I’ll test how it works and see whether it’s worth doing.

---

<div class="post-metadata">

### Author: ![Morfik](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/morfik/32/120704_2.png) [@Morfik](https://meta.discourse.org/u/Morfik)
#### Post date: [13 בספטמבר,‏ 2017,‏ 8:44pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001/6 "2017-09-13T20:44:58Z")

</div>

Ok, so it would be something like this, right?

```
discourse-# \connect discourse
discourse=# delete from post_revisions *;
discourse=# update posts set public_version=1 where public_version>1;
discourse=# update posts set version=1 where version>1;

```

---

<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: [8 ביוני,‏ 2024,‏ 12:44pm UTC](https://meta.discourse.org/t/is-there-a-way-to-remove-all-post-revisions-from-all-the-posts/70001/7 "2024-06-08T12:44:15Z")

</div>

This topic was automatically closed after 2459 days. New replies are no longer allowed.
