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

OK, looks like nobody can help with this. Would recreating the forum from scratch help, then restoring saved database backup? Or would restoring the backup just propagate the deletions again?

I think that it would sorry.

Somewhere in that database is the little bit of data that you must change to make those posts appear once more. Here in fact:

In the ‘topics’ table, deleted_at will have a timestamp for ID 4, 5, and 6. If you can delete these (replace with nothing / blank) then you will be back in business.

I know that you can do this from Ruby/Rails, but that is outside of my skills thusfar - but for someone with the skills it would be a 5 minute job. Perhaps whoever set you up with the instance can help out.

Thanks Nathan.
Sadly, I set myself up following the official tutorial, with little comprehension.
I did have a developer migrate some material in for me early on, and contacted them about this a week ago, but no luck so far getting a response.

What I am wondering though is if there is an open source desktop application that connects to and allows viewing and editing of postgre tables in Digital Ocean? Or even that could read and edit a downloaded backup, which I then restore?

** Edit - rereading replies to a similar query, the consensus seems to be to use Ruby if doing anything
at all, rather than a friendly looking GUI database application.

That said, what are the commands I would issue in PuTTY to access the database and delete the timestamps for topics ID 4,5 and 6 in the topics table deleted_at? (after backup taken)?

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

SELECT *
FROM topics
WHERE deleted_at is not NULL
AND category_id = 3 

or even in any category

SELECT *
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
FROM
site_settings

returns
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?

3 Likes

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:)

2 Likes

@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.

2 Likes

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?

I’m not sure how you got on in the end, Paul, but you could now construct your own TOS and Privacy pages using this:

2 Likes

Awesome! Thanks for the heads up Nathan.

Confirming this did the trick!

You have to also copy/paste the urls generated for published posts into the corresponding feilds in Settings/Legal as if these were ‘externally hosted’ Terms of Service & Privacy Policy pages, if you want the links to these in the new signup dialog to work. (not sure why FAQ is omitted from sign up dialog, but you can also set this url here as well - though not sure purpose of this feild/what otherwise links to it if not included in signup dialog?

A workaround that might unravel if the site ever moved to another url, but great in the meantime to at least allow people the option to see what the terms of service etc actually are before they sign up!

1 Like