Trying to adjust the date added metadata field in the Database

Server Version#: 1.40.5.8921
Player Version#: Plex Web 4.133.0

Recently movies were removed and re-added to the libraries. Now they appear at the top of the “Recently Added” list. I would like to adjust the “added_at” timestamp for an item(s). I found articles on this topic stating to directly modify the database using “SQLite” for my Ubuntu distribution, but when I open the database in “SQLite” and run the following SQL query: “SELECT * FROM metadata_items”, no results are returned.

If this has been affecting more than just a handful of items, I think you are better off by restoring a database backup.
https://support.plex.tv/articles/202485658-restore-a-database-backed-up-via-scheduled-tasks/

Hello OttoKerner:

I do not believe anything is wrong with my database. All of my movies, TV Shows, and libraries are intact. I just need a way to view/modify the database from the command line in order to change the “added_at” field of the “metadata_items” table. Do you know how to seamlessly accomplish this task?

Otto was most likely referring to that support document as its a way to restore a backup from before the scan happened which changed the added dates/times. This can happen when stuff like Empty trash automatically after every scan is enabled.

Anyhow, directly access the db is typically something the the plex staff and moderators don’t support as its very much an advanced task and something you need to be very comfortable with. Its not recommended for 90% of users.

Anyhow, for starters you say I open the database in “SQLite”. Are you using the sqlite which comes with plex ? So basically this "/usr/lib/plexmediaserver/Plex Media Server" --sqlite /tmp/com.plexapp.plugins.library.db (adjust the db path for db).

Maybe a screenshot or the exactly commands you are using might help debug. I’d also always recommended doing edits when you plex server is down or even better against a backup db copied to some temp location.

dokuro, OttoKerner:

I was able to resolve the issue. I discovered that I was attempting to modify the database in the “$USER” folder path (no records) instead of the database " `/usr/lib/" folder path (many records) as “dokuro” suggested. Made my modifications to the “added_at” field of the “metadata_items” table, and the items in questioned moved further down the Plex dashboard “Recently Added Movies” list. Thanks to everyone for their help troubleshooting this problem/solution.

P.S.

You’ll need elevated privileges to set the database in w/r mode to make changes.

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