Replies: 1 comment 6 replies
-
Related to: https://docs.photoprism.app/getting-started/troubleshooting/performance/#migration-from-sqlite |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you plan on importing lots of pictures, or having your photo library grow, just start from zero with MariaDB instead of sqlite which won't scale.
If you have tons of data already, are migrating, and have problems, some of these notes might help you.
I'm using TrueNas Scale with the Photoprism official chart.
After some time importing (a couple of hundreds of Gb's of photos taken over the years) the db was stuck in a locked state for way too long.
So I installed mariadb via docker, enabled tcp access in mariadb config, and made sure the port was forwarding well (external 9306 to internal 3306).
Create the photoprism db using https://raw.githubusercontent.com/photoprism/photoprism/develop/internal/entity/schema/mariadb.sql
listed at https://docs.photoprism.app/developer-guide/database/ and created the photoprism db user/pass.
Then used techouse/sqlite3-to-mysql to migrate the sqlite index.db file into the photoprism mariadb database. I shut down, set photoprism to use mysql instead of sqlite, and things seemed to work.
Except lots of errors in photoprism logs that ended up being mostly resolved by adding auto-increment to key fields in some tables.
I tried "photoprism migrate" and it seemed to update the schema. A note on this, is that most of the docs say "photoprism migration" and for some reason in mine it's "migrate" instead of "migration"
Since I was getting lots of
errors like:
ERRO keyword: Error 1364: Field 'id' doesn't have a default value (find or create collateral)
I needed to make several id columns auto increment in the mariadb photoprism database for it to work well.
I was still having issues, so I enabled the general_log file to trace a little more.
I found:
Prepare INSERT INTO
albums
(album_uid
,album_slug
,album_path
,album_type
,album_title
,album_location
,`album_categoSo it was not inserting "id" and the db has it and didn't know what to put there as a default. I am guessing id is replaced by uid.
Awesome functionality in photoprism!
If I were to do it again, I would just start with this compose file https://dl.photoprism.app/docker/docker-compose.yml listed at https://docs.photoprism.app/getting-started/advanced/databases/
Beta Was this translation helpful? Give feedback.
All reactions