Script to remove post from database
Since nodebb does not remove post from the database (only marking it as deleted), I have created this script to remove the post
from the database (redis only).
Put it in the same location as config.json, modify as needed, and run with:
$ node remove_post.js.
Why not create a plugin out of it, using NodeBB's database functions so that it works across all databases?
I just want a quick solution.
If you look at the code, I already use the db methods, but the db doesn't provide method to iterate the keys so I have to call redis client directly.
@char101 Yeah, we don't expose the
KEYSredis command because it is very inefficient
O(N)where N is the # of keys in the database
Check out this commit https://github.com/NodeBB/NodeBB/commit/a65d61290742fef5ed76834a73e069336ebe5b6b and this file https://github.com/NodeBB/NodeBB/blob/master/src/posts/delete.js.
@baris Thanks, now that it's a builtin function, it's even better.
How about notifications that refers to the deleted topic, is these not required to be deleted?