# NULL first\_visited\_at dates in the topic\_users table

**URL:** <https://meta.discourse.org/t/null-first-visited-at-dates-in-the-topic-users-table/45996>\
**Category:** Development\
**Created:** [June 18, 2016, 9:17am UTC](https://meta.discourse.org/t/null-first-visited-at-dates-in-the-topic-users-table/45996 "2016-06-18T09:17:15Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [June 27, 2016, 1:10am UTC](https://meta.discourse.org/t/null-first-visited-at-dates-in-the-topic-users-table/45996/4 "2016-06-27T01:10:20Z")

</div>

I’ve done some more testing.

It definitely has to do with tracking state.

When a member is either Tracking or Watching a category, a row is inserted into the topic\_users table when a topic is created in that category.

A row is not inserted into the topic\_users table when a topic is created if a member has that category tracking state set to Mute or Normal.  
And the row may not be created depending on other of the members Preference settings, if they post a reply in the topic etc. i.e. one of

```plaintext
created_topic: 1, 
user_changed: 2, 
user_interacted: 3, 
created_post: 4, 
auto_watch: 5, 
auto_watch_category: 6, 
auto_mute_category: 7, 
auto_track_category: 8, 
plugin_changed: 9

```

When a member visits a topic the logic tests for the presence of a row in the table.  
If there is no row an INSERT is done.  
If there is a row, an UPDATE

I think the solution would involve checking for the presence of a NULL first\_visited\_at field in someway somewhere. But I don’t know what would be the best way to go about it yet.

---

_[View the full topic](https://meta.discourse.org/t/null-first-visited-at-dates-in-the-topic-users-table/45996)._
