How Regenerate droped table post_search_data?

By mistake i delete the table post_search_data in discourse data, How this table can be regenerated ? As this table depend upon the table posts, there might be a way to regenrate it, please help.

Do you have a backup?

2 Likes

not have backup, is there not a way to populate the tsvector directly with PSQL and the raw also, using ssh ?

There is a rake tast that regenerates the index

./launcher enter app
rake search:reindex

I would strongly recommend restoring from a backup though if you have started mucking around with tables. Who knows what else happened.

6 Likes

thank you very much sir, next time i keep a backup, before playing with tables.

sorry forgot to mention, i am on development enviorment not docker. what should i run in ruby ?
should i run this ? but how ? what command exact command ?
discourse/app/services/search_indexer.rb
i am running
rake search:reindex lets see

thanks it saved my big time.

If you’ve nothing important in development mode, you can run the following commands to recreate the entire db

rake db:drop db:create db:migrate
6 Likes

SIR, I am import DB in development to use it in production, if i use it, it will reset the db ???

Yes, it will reset the DB. But doing this and re-running the import may be the sanest way forward if you messed with the database…

2 Likes

Yea don’t run it if you have any important data that you can’t recreate in development mode.

3 Likes

Thanks, it helped a lot.