So, I accidentally deleted the wrong library. Yes, I’m an idiot. I immediately re-added the library and luckily Plex remembered all watched states. Lucky me!
Not so lucky, the library had ID 3… but the new one has ID 30. So now, instead of being the second library, it’s the last one. And I’d really like it if I could change the order back. So, I backed up my database, copied it to my laptop and opened it up in an SQlite editor. Found all tables with a library_section_id column that actually had any data in it and eventually ran these queries:
UPDATE directories SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE library_section_permissions SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE library_timeline_entries SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE media_items SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE media_part_settings SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE metadata_item_views SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE metadata_items SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE section_locations SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE synced_library_sections SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE synced_metadata_items SET library_section_id = 3 WHERE library_section_id = 30;
UPDATE library_sections SET id = 3 WHERE id = 30;
Copied that edited database back and started Plex server… and now that specific library gives me a 404 error. Copied back the original database and it works again. Last in line, of course.
Did I miss a table/column somewhere?
