We have a use case where we need to close all existing topics and unlist them. I have closed all topics using the rails console by executing
Topic.where(closed: false).find_each do |topic| topic.update_status("closed", true, Discourse.system_user) end
But, when I try to do the same to unlist topics by executing
topic.update_status("unlisted", true, Discourse.system_user)
I get this error:
ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "unlisted" of relation "topics" does not exist LINE 1: UPDATE "topics" SET "unlisted" = 't' WHERE "topics"."id" = 1
From which I understand that there is no
unlisted column for the topic object.
How can I unlist a topic using console?