# How to mark imported posts as read

**URL:** https://meta.discourse.org/t/how-to-mark-imported-posts-as-read/162696
**Category:** Support
**Created:** [September 1, 2020, 7:11pm UTC](https://meta.discourse.org/t/how-to-mark-imported-posts-as-read/162696 "2020-09-01T19:11:59Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![stuwest](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stuwest/32/192400_2.png) [@stuwest](https://meta.discourse.org/u/stuwest)
#### Post date: [September 1, 2020, 7:11pm UTC](https://meta.discourse.org/t/how-to-mark-imported-posts-as-read/162696/1 "2020-09-01T19:11:59Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![stuwest](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stuwest/32/192400_2.png) [@stuwest](https://meta.discourse.org/u/stuwest)
#### Post date: [September 1, 2020, 10:00pm UTC](https://meta.discourse.org/t/how-to-mark-imported-posts-as-read/162696/2 "2020-09-01T22:00:32Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [September 2, 2020, 3:49am UTC](https://meta.discourse.org/t/how-to-mark-imported-posts-as-read/162696/3 "2020-09-02T03:49:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![stuwest](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stuwest/32/192400_2.png) [@stuwest](https://meta.discourse.org/u/stuwest)
#### Post date: [September 2, 2020, 7:52pm UTC](https://meta.discourse.org/t/how-to-mark-imported-posts-as-read/162696/4 "2020-09-02T19:52:34Z")

</div>

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

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [September 2, 2020, 8:58pm UTC](https://meta.discourse.org/t/how-to-mark-imported-posts-as-read/162696/5 "2020-09-02T20:58:00Z")

</div>

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](https://github.com/discourse/discourse/blob/master/app/models/topic_user.rb) and [PostTiming](https://github.com/discourse/discourse/blob/master/app/models/post_timing.rb) 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.

> <https://github.com/discourse/discourse/blob/e0d9232259f6fb0f76bca471c4626178665ca24a/script/import_scripts/base.rb#L750-L773>

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 2, 2020, 8:58pm UTC](https://meta.discourse.org/t/how-to-mark-imported-posts-as-read/162696/6 "2020-10-02T20:58:46Z")

</div>

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