Adding view history from old database to new, progress to date & questions

Server Version#: 1.41.6.9685

Platform: Truenas Core (freebsd)

Quick background, when I updated from 1.2X to 1.4X, I ended up needing to delete the contents of Plug-in Support/Databases to get everything back up and running.

I’ve been endeavoring to re-integrate the view history from my old com.plexapp.plugins.library.db into the current database. The progress I’ve made so far:

-Identified metadata_item_views table as containing the play history
-Added view_type column with the INTEGER type and default 0 to old table
-Incremented id entries in current metadata_item_views so as no not overlap old entries
-Imported metadata_item_views into current db

Things mostly show up correctly in view history, save for a handful of "unknown user"s in the User column via the Plex UI. I bet the ‘unknown user’ entries are from a couple users that haven’t used this server since I updated, most users show up correctly. However several features like the ‘Top Users’ section and the ‘Play History’ graph don’t seem to account for the added view history.

I would really like to get this fully integrated / working, the old db contains a lot of my mother’s view history and for personal reasons I would really enjoy being able to look at this from time to time.

I guess I have two questions:

  1. Is what I’m trying to do even possible?
  2. Is there a better procedure for getting it done? All of the database versions are backed up, so I can start the process from scratch at any time.

I might attempt to revert to 1.2X and integrate the new view history into the old db instead, I suspect the creation date of the server and/or database has something to do with it. There aren’t any new features in 1.4X that I need so 1.2X will serve just fine.

EDIT: Looks like I might need to grab metadata_item_settings in a similar fashion. Barring any different feedback I’ll try that next.

See https://support.plex.tv/articles/201154527-move-viewstate-ratings-from-one-install-to-another/

You should use Plex SQLite when modifying the database. See https://support.plex.tv/articles/repair-a-corrupted-database/.

Yep, that article was where I got the idea to import metadata_item_settings.

I had started using Plex SQLite to resolve errors about the database being malformed.

It is very important to know that this method is only working as long as you haven’t watched anything on the newly set up server yet.

Gotcha, I saw that mention in the article linked above. Is that because of the overlapping IDs, or because something gets set internally once the first view happens?

Would adding entries to the views database that are newer than the latest entry work?

I guess I’m asking if new manually created view entries would be picked up and integrated into the other metrics, or if they would be ignored the same way old entries added after the fact are.

I don’t know the database structure well enough to be able to answer.

I’m not sure that they are ignored. More likely they would create wrong data, like negative view counts and such.

Thanks for the feedback. Sounds like I need to test it and report back.

I’m in a similar boat, but I’m not upgrading plex from another version but instead doing a library upgrade with new agents, and this has been an issue for a library of mine because I used a custom agent for years. So need to figure out a way to convert it to the new agents.

https://support.plex.tv/articles/migrating-a-tv-library-to-use-the-new-plex-tv-series-agent-scanner/

https://support.plex.tv/articles/upgrading-a-movie-library-to-the-use-the-new-plex-movie-agent/

I will try this later today, fingers crossed it works well for me.

Else I was thinking of writing some script to edit the db.

Edit: I don’t have the option to “Upgrade Matching”.

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