How can I delete or undelete topics?


(Robin Ward) #21

There is no documentation for this unfortunately, as it is quite an advanced repair technique. I’m not sure how you’ve installed discourse but if you access the database you’ll want to issue a DELETE FROM topic_embeds - of course be warned that will remove all existing links between posts and embeddings. So if you have any in a good state they will be removed too.


(Alex Armstrong) #22

I have three posts that were somehow undeleted, while all the rest are deleted (and refuse to be undeleted). I’m perfectly happy to deleted the three and unlinking them.

This would allow me to link me to create new topics based on the same blog posts, right?

If so, I’d like to try this.

My Discourse uses the vanilla Docker install in a Digital Ocean droplet. I have a local Vagrant version, which I’ve used to run experiments. For obvious reasons, I would liked to try this in the Vagrant version before doing it in production :slight_smile:

I need a bit more help though. If I ssh into vagrant and open the console with rails c. What then?


(Mittineague) #23

That’s a c for Console
It will let you run Ruby from the command line.

Similarly you can rails db and run DataBase queries from the command line.

*Hint, please do yourself a favor and save backups or be prepared and willing to start from scratch if things turn sour.


(Kane York) #24

In other words: Footgun, batteries not included


(Alex Armstrong) #25

I’ll be working in my local Vagrant instance using a backup from the production docker. Starting from scratch is not an option at this point. We have migrated our Ning forum to Discourse and it’s now live and being used. There was, unfortunately, no indication in the embedding documentation available about any of these issues.

I’m still not sure what I’m doing. I tried this:

[vagrant@precise32:/vagrant (master)]$ rails db
psql (9.4.1)
Type "help" for help.

discourse_development=> DELETE FROM topic_embeds
discourse_development->
discourse_development-> \q

But it doesn’t seem to be working. Or I don’t understand how to test this.

I visited the local version of the website http://www.example.dev/blog/profiles-and-events but the “Continue the Discussion” link there tries to take me to old (deleted) topic at http://localhost:4000/t/profiles-events/18.

FWIW, I have www.example.dev as an allowed host.

Suggestions?


(cpradio) #26

I think you need to end your statement with ;, otherwise it thinks you are trying to write a multi-line query.

Example:

DELETE FROM topic_embeds;

(Bali Bebas!) #27

Just landed here after I deleted a topic I’d created under Discourse 2 and low and behold this sage advice still works to restore deleted topics. That’s awesome! :smile:


(Sora &\) #28

How can we restore topic discourse?
I deleted content of first topic, so it’s lost, now i wanna restore them. How do i?
Do Discourse have recycle bin topic?
Thank you!


(Daniela) #29

Search example.com/latest?status=deleted, find the deleted topic and click the Un-delete button

image


(Michelle) #31

Thanks-you very much! Works perfectly :kissing_heart:


(Sora &\) #32

How can i search or list all topic Make unlisted?