Pre seeded posts all missing - Missing Terms of Service, FAQ and Privacy pages

Hi again - in my lame way, I tried the following query in Data Explorer, and got no relevant hits for messages deleted in the Staff category

FROM topics
WHERE deleted_at is not NULL
AND category_id = 3 

or even in any category

FROM topics
WHERE deleted_at is not NULL

So wondering if there is something else going on if the topics were not deleted?. Is there some other way to detect those missing topics? Or are system posts perhaps not stored in the topics table at all?

Good to see your Data Explorer skills!
Those topics are definitely in the topics table.

Try this:

SELECT id, title, deleted_at
FROM topics
Order by id
Limit 10

You should get something like this:

PS you might also need to change deleted_by_id

Hey @Paul_King, have you tried this?

1 Like

Thanks Nathan - a great suggestion
However the lowest topic ID found amongst deleted topics is 20

Do you have any of 1-10? It appears not.

It could be that rebuilding the site from scratch and then merging the databases in some way is the way forwards. Or get hacking that postgres!

Hi Nathan - that definitely lists a bunch of deleted topics, but none of the pre-seeded ones missing from the staff category

I am wondering if I even can hack the database to cancel deletions if there is no sign of the missing pre-seeded posts ever having existed? Is there a way to rerun the setup wizard on an existing installation, to trigger those pre-seeeded posts to be created? Is there some way the setup wizard could have omitted them the first time? (perhaps there was an option where I clicked ‘skip’ the first time round?)

Is it possible that there was a bug in play with the then current discourse version at the time I set up?

Is it possible that if the missing pre-seeded posts are not even marked as deleted, but simply don’t exist, the absences will not propagate or overwrite anything if I restore backed up database to a fresh Discourse install? Or is it the case that the starting database is removed entirely and replaced by the backup, with all its flaws?

Another thing to try is selecting tos_topic_id, guidelines_topic_id, and privacy_topic_id from the site_settings table.

Sorry, with this SQL:

SELECT value
FROM site_settings
WHERE name = 'tos_topic_id'

Thanks Kane

I may well be doing this wrong but for me
SELECT tos_topic_id, site_settings

or (not sure which is correct, if any)

SELECT tos_topic_id

PG::UndefinedColumn: ERROR: column “tos_topic_id” does not exist
LINE 7: SELECT tos_topic_id, site_settings

Which I take to mean there is no ‘tos_topic_id’?

Similar result for guidelines_topic_id , and privacy_topic_id

This may helps: How to regenerate FAQ and TOS pages?


Thank you!! That is exactly what I was looking for - though sadly for me the final
rake topics:update_static[en]
command gives an error - not sure why, or how to deal with it.

What’s the error? (It’s always a good idea to post the error if you want help. :wink:)


@Paul_King I encountered an error too when run update_static, but my FAQ page is back!
@gerhard The error is the followings and I guess it’s same for Paul.

[5] pry(main)> rake topics:update_static[zh_CN]
NameError: undefined local variable or method `update_static' for main:Object
1 Like

You were running the rake task in the rails console which doesn’t work. But when you run it correctly, you will notice that the rake task doesn’t exist anymore. :wink:

Instead I recommend using the “Manual Update” method described in Update seeded categories and topics. I edited the steps in How to regenerate FAQ and TOS pages? accordingly.


Is there a way to get the TOS and Privacy links in the signup dialog to work? Nothing above seems to have achieved that for me, though I can recreate TOS and Privacy topics that are not linked.

I am unsure exactly how these topics came to be missing in the first place. I just assumed I must have deleted them accidentally somehow when I discovered they were missing, but from my reading it seems this is not even supposed to be possible within the user interface - and given others seem to have struck a similar issue, could this involve a possible bug somewhere?