How to mark imported posts as read

I’m currently working on importing data from a custom-written forum into Discourse. The legacy forum has ~30K topics and ideally I’d like to mark them all as read during the import process. If I understand correctly, the relevant table here is post_timings.

My question is, is it enough to add an entry in post_timings for the most recent post in every topic for every user? Or would I have to add an entry for every post, roughly 700K posts * 2K users?

Just to add some details about my specific use case: the legacy forum software we’re migrating from is limited but simple and our members have a wide range of ages and levels of technical proficiency. We have set up a Discourse instance for members to try out while we prepare to migrate and we have had a few comments that it is quite overwhelming.

I think that is just the learning curve – I feel that way a little myself, and I am an IT professional. Once people get used to the change I think they will see Discourse is a clear improvement over the legacy software.

What I am worried about is losing people before they reach that stage. If users are sent back to the first post of a 1,000-post topic the first time anyone posts a reply to an imported thread, that is a big hit to usability, and I think it’s possible some members will just give up. So I am really keen to mark all imported posts as read and allow users to get straight to the new material.

I did search the archive before posting this, but didn’t find anything that answered this specific question.

1 Like

I think there is probably an easier way to do this during a migration, perhaps @gerhard would know?

1 Like

Hi @gerhard, do you have any information on how to mark imported topics as read?

You need to create records in the topic_users table and in the post_timings table. You can either use the methods in the TopicUser and PostTiming models or do it more efficiently by using SQL.

Here’s an example from the base import script which marks posts as read for their authors. You’d need to adapt it for your use case.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.