# /posted empty with a phpbb3 import

**URL:** https://meta.discourse.org/t/posted-empty-with-a-phpbb3-import/256443
**Category:** Migration
**Tags:** phpbb
**Created:** [February 27, 2023, 10:34pm UTC](https://meta.discourse.org/t/posted-empty-with-a-phpbb3-import/256443 "2023-02-27T22:34:15Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 27, 2023, 10:34pm UTC](https://meta.discourse.org/t/posted-empty-with-a-phpbb3-import/256443/1 "2023-02-27T22:34:15Z")

</div>

I did a phpbb3 import for a site. The admin user has thousands of posts, and that’s listed on the user summary page, and in `https://estude.profcaju.com/u/USER/activity` but when that user visits `/posted` they get only topics since the import.

When I look at I look at an imported topic that was created by the user, and pull up Topicuser for that topic/user, `posted` is set to false. I’ve run all of the `ensure_consistency` things I can find (`TopicUser`, `Topic`, `User`).

If I set `posted` to true in a TopicUser, it will show up in /posted.

Should I do something like `TopicUser.where(user_id: 1).update_all(posted: true)`? Should I do that for all users?

---

<div class="post-metadata">

### Author: ![cocococosti](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cocococosti/32/231474_2.png) [@cocococosti](https://meta.discourse.org/u/cocococosti)
#### Post date: [February 28, 2023, 6:03am UTC](https://meta.discourse.org/t/posted-empty-with-a-phpbb3-import/256443/5 "2023-02-28T06:03:57Z")

</div>

Thank you for reporting this Jay!

Seems like an issue with the `ensure_consistency` rake task. I just checked on a migration I’m working on now (haven’t run the ensure\_consistency task yet) and the TopicUser records were already created with posted: false (the default). When the rake task reaches [this point](https://github.com/discourse/discourse/blob/main/lib/tasks/import.rake#L60) it generates a “duplicate key” error and the records are not created because of the `ON CONFLICT DO NOTHING`

```plaintext
def insert_topic_users
  log "Inserting topic users..."

  DB.exec <<-SQL
    INSERT INTO topic_users (user_id, topic_id, posted, last_read_post_number, first_visited_at, last_visited_at, total_msecs_viewed)
         SELECT user_id, topic_id, 't' , MAX(post_number), MIN(created_at), MAX(created_at), COUNT(id) * #{MS_SPEND_CREATING_POST}
           FROM posts
          WHERE user_id > 0
       GROUP BY user_id, topic_id
    ON CONFLICT DO NOTHING
  SQL
end

```

The TopicUser records are created at the create\_topic step, more specifically here [discourse/lib/topic\_creator.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/lib/topic_creator.rb#L69).

I opened a PR with a fix that you could run now:

[https://github.com/discourse/discourse/pull/20473](https://github.com/discourse/discourse/pull/20473)
