How Regenerate droped table post_search_data?

(Veer) #1

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.

(Alan Tan) #2

Do you have a backup?

(Veer) #3

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

(Sam Saffron) #4

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.

(Veer) #5

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

(Veer) #6

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 ?
i am running
rake search:reindex lets see

thanks it saved my big time.

(Alan Tan) #7

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

(Veer) #8

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

(Felix Freiberger) #9

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…

(Alan Tan) #10

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

(Veer) #11

Thanks, it helped a lot.