I have imported about 500,000 posts to my discourse instance.
i would like to delete all posts and topics to re-import all my posts.
does anyone have any idea how to do this?
I have imported about 500,000 posts to my discourse instance.
i would like to delete all posts and topics to re-import all my posts.
does anyone have any idea how to do this?
If you want to start from scratch, I would use the rails console to re-create a new database
rails db:drop db:create db:migrate
THIS WILL DELETE EVERYTHING (users, site settings, etcâŠ)
the thing is i want to keep all the other settings i have.
What other settings?
design, site name⊠and other settings my client may have changed.
i donât see why i would have to reset everything.
there gotta be another way.
In that case, you could do this in the rails console
Post.order(id: :desc).each do |post|
PostDestroyer.new(Discourse.system_user, post).destroy
end
this is working wayy to slow. it deleted about 10000 posts in about 1 hour.
is there anyway to do this faster?
Only the first method I mentioned will. If you use anything else, you will end up with an inconsistent database.
is there a way to backup only the settings?
Iâm afraid not yet. But you can do it manually. All the settings (ie. /admin/site_settings
) are stored in the site_settings
table. Just dump that table and restore it once youâve re-created the database.
i do not come from the rails world,
is it to much to ask how i can do that?
something like this ?
rake db:site_settings:dump
Itâs actually a postgresql thing Hereâs how to dump the site_settings
table
pg_dump -a -t site_settings -f site_settings.sql discourse_development
/usr/lib/postgresql/9.3/bin/pg_dump: invalid option â âDâ
Try âpg_dump --helpâ for more information.
You can remove that -D
parameter. Sorry.
just remembered i have 200,000 users i would like to keep as well anyway to easily export those?
Iâm afraid there is noneâŠ
OK, thank you so much. you helped me a lot.
There is now a rake task for this: