# Database, date added breaks again during adding media

**URL:** <https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032>\
**Category:** Plex Media Server\
**Tags:** server-linux, server-qnap, plex-web\
**Created:** [October 8, 2022, 1:29pm UTC](https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032 "2022-10-08T13:29:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paleosonic](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@Paleosonic](https://forums.plex.tv/u/Paleosonic)\
**Post date:** [October 8, 2022, 1:29pm UTC](https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032/1 "2022-10-08T13:29:24Z")

</div>

Server Version#: 1.28.0  
Player Version#: Plex Web 4.84.1

I’m running PMS on a QNAP TS-253A with QTS 5.0.1.2173.  
In August 2022, I posted about database corruption that I was not able to recover from!  
This this time I uninstalled the PMS application, deleted all folder content from the PMS folder, and give it another try to use PMS.

After pointing to some decade old media collection on the same NAS as PMS, the first movies show up as added 18 years ago. Then, for no obvious reason, media shows up as added “a few seconds ago”!

This is driving me nuts! Why is there not an option to force reading the file modified date?

In the database table “metadata\_items” I’m looking if overwriting the UNIX time “created\_at” with “added\_at” or “originally\_available\_at” would make sense.  
But without knowing the cause for the above mentioned problem, I doubt this is a proper solution.

So, please give me some advice how to fix this for ever.

BTW, my filesystem uses this date/time formatting: 2010-07-26 17:11:19 “%Y-%m-%d %H:%M:%S”

---

<div class="post-metadata">

**Author:** ![anon5074910](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@anon5074910](https://forums.plex.tv/u/anon5074910)\
**Post date:** [October 8, 2022, 1:46pm UTC](https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032/2 "2022-10-08T13:46:34Z")

</div>

> [@Paleosonic](#):
>
> In the database table “metadata\_items” I’m looking if overwriting the UNIX time “created\_at” with “added\_at” or “originally\_available\_at” would make sense.

Many folks have been working around this for years and there are many topics in the forum on it. The `metadata_items` table is the one you want to change along with `added_at`. Something like the following will do it which will set `added_at` = `originally_available_at` …

```auto
UPDATE metadata_items SET added_at = originally_available_at WHERE added_at <> originally_available_at AND originally_available_at IS NOT NULL AND library_section_id = 1;

```

BTW… `library_section_id` will be different for you. 1 is my movies library but it could be something else for you.

However, I’ve rebuilt my server more times than I can remember and the recently added does respect my NAS filesystem dates for my media. I have found what is IMPORTANT is to full disable (set to NEVER) the library heavy duty tasks until AFTER all libraries are created and the first matching metadata fetch is complete. I also have only one library per type so that probably helps with this also.

 ![Screenshot from 2022-10-08 14-44-09](https://global.discourse-cdn.com/plex/original/4X/e/6/c/e6c318452dd3711daed14fdba6b4f639e9677899.jpeg)

Anyhow, passing along my knowledge in the hope it might help a little.

---

<div class="post-metadata">

**Author:** ![Paleosonic](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@Paleosonic](https://forums.plex.tv/u/Paleosonic)\
**Post date:** [October 8, 2022, 2:24pm UTC](https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032/3 "2022-10-08T14:24:26Z")

</div>

Thank you @anon5074910 , I already found some of these topics.  
Your SQL command, looks better than the older solutions I found.  
My `library_sections_id` lists only 5 and 7 (I wonder why it doesn’t start at 0).

Using the `originally_available_at` is kinda awkward workaround especially when media was released before the computer era 😉

I’ll try once more with these heavy duty tasks disabled, for it makes sense the software choked and start misbehaving.  
I can only only find 3 options from your screenshot. I guess you’re using another PMS version?

---

<div class="post-metadata">

**Author:** ![Paleosonic](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@Paleosonic](https://forums.plex.tv/u/Paleosonic)\
**Post date:** [October 8, 2022, 4:36pm UTC](https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032/4 "2022-10-08T16:36:51Z")

</div>

Turned off all heavy tasks, added music starting with 0-9 and all went well (some added to my collection 19 years ago) . But when adding music starting with A, it showed as being added today to my collection!  
It seems PMS just doesn’t respect my filesystem.

I followed this tutorial for manipulating the database [https://support.plex.tv/articles/repair-a-corrupted-database/](https://support.plex.tv/articles/repair-a-corrupted-database/)  
Note that to use the `Plex SQLite` on Linux machines, you need to do that as sudo.

```auto
sudo "/share/CACHEDEV1_DATA/.qpkg/PlexMediaServer/Plex SQLite" com.plexapp.plugins.library.db

```

This is still not a proper solution, and I hope some PMS guru can come up with a better solution to have a way for accessing fresh added media.

---

<div class="post-metadata">

**Author:** ![anon5074910](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@anon5074910](https://forums.plex.tv/u/anon5074910)\
**Post date:** [October 8, 2022, 5:12pm UTC](https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032/5 "2022-10-08T17:12:13Z")

</div>

> [@Paleosonic](#):
>
> I can only only find 3 options from your screenshot. I guess you’re using another PMS version?

Curious. What version of plex server do you have installed ?

I don’t run plex directly on my NAS so maybe the date stuff is a side effect of that. Let’s see if someone else has an idea.

---

<div class="post-metadata">

**Author:** ![Paleosonic](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@Paleosonic](https://forums.plex.tv/u/Paleosonic)\
**Post date:** [October 9, 2022, 9:38am UTC](https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032/6 "2022-10-09T09:38:18Z")

</div>

Version is as mentioned in opening post, provided by QNAP AppCenter.

 ![limit-high-cpu-usage](https://global.discourse-cdn.com/plex/original/4X/e/e/c/eecada8c8b74c3a317d735124c883209da43d3a7.png)

All my music is now added to the database with proper modify file date!  
Movies are still not okay.

I decided not to use `originally_available_at` date for `added_at` because that is already the column being used for sorting by release date!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [January 7, 2023, 9:38am UTC](https://forums.plex.tv/t/database-date-added-breaks-again-during-adding-media/814032/7 "2023-01-07T09:38:27Z")

</div>

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