Bug 426116

Summary: Compact database (unique block instead of loose files)
Product: [Applications] digikam Reporter: Jo <jo.y.venn>
Component: Database-EngineAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: wishlist CC: caulier.gilles, mario.frank, metzpinguin
Priority: NOR    
Version: 7.0.0   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In: 8.1.0
Sentry Crash Report:

Description Jo 2020-09-02 19:39:48 UTC
SUMMARY
A compact database (unique block) would be less messy than a database with several loose files, in addition i'd prefer to see database files in a folder related to the Application's specific preferences, on Mac this would be ideally in "home/library/application support/digikam/", which exists also on my HD.


SOFTWARE/OS VERSIONS
macOS: 10.14.6
Comment 1 caulier.gilles 2020-09-02 19:46:10 UTC
What do you mean by conpact "database"

Do you talk about the core database files used by digiKAm to store all metadata for the DAM ?

Do you talk about the collection of album ?

Gilles Caulier
Comment 2 Jo 2020-09-03 05:35:13 UTC
I'm talking about the database files created to monitor folder and file changes on hd 
(digikam.db, recognition.db, similarity.db, thumbnails.db, etc. ), so it'll be the collection of albums
Comment 3 Maik Qualmann 2020-09-03 06:57:19 UTC
There is a reason that these 4 files are separate and not in a database. SQLite cannot read and write at the same time. So that the processes can be better scale and to reduce unnecessary waiting for the database, there are 4 files. You can save the databases to any location in your system where you have write access.

Maik
Comment 4 Jo 2020-09-03 07:44:55 UTC
Yes, I no doubt, my question wasn't to unify databases into one  big and inefficient database, but to create a kind of Digikam file that contains all these database data, to clean up all those loose files 

>You can save the databases to any location in your system where you have write access.

Sounds good, so could you move them by default in an application specific preferences folder, please ?
Comment 5 Mario Frank 2020-09-03 08:53:22 UTC
Hi Jo,

Depending on the OS, the default location of databases may be different.
So there is no easy catch for all OSs.
Usually, the location is defined in the digikamrc.

The digikamrc contains the following settings:

Database Name=/path/to/core/db/
Database Name Face=/path/to/core/db/
Database Name Similarity=/path/to/core/db/
Database Name Thumbnails=/path/to/core/db/

In your case, you could move the files to 

/home/library/application support/digikam/sqlite_db/

and set the values to 

Database Name=/home/library/application support/digikam/sqlite_db/
Database Name Face=/home/library/application support/digikam/sqlite_db/
Database Name Similarity=/home/library/application support/digikam/sqlite_db/
Database Name Thumbnails=/home/library/application support/digikam/sqlite_db/

When starting digiKam again, this should work without any problems.

Also, there is a command line option for digiKam:

--database-directory <dir> 

this one will search for the db files in the specified directory.

Does this solve your problem?

Cheers,
Mario
Comment 6 Jo 2020-09-10 05:17:59 UTC
Hi Mario,
Sounds nice, and exactly what I'm  looking for. 
The only drawback is I've to edit the paths each newly added database again. Not that it happens very often, so it might be ok. Still i see it technically useful to implement, so my report 

Yes, I'm aware the path to the  application specific preferences folder can't be defined unequivocally the same for all platforms, but needs to be defined specifically for each Os

Since Digikam knows already the path to application support folder, I'd love to see Digikam make use of this path automatically as much as possible,
For what pertains preference related files. 
So all those loose files are out of the way, so to say
Comment 7 caulier.gilles 2023-05-18 06:19:34 UTC
The online doc list all paths used by the application to store files:

https://docs.digikam.org/en/getting_started/installation.html#configuration-files
https://docs.digikam.org/en/setup_application/database_settings.html

To compact the database, there is no plan for this topic for technical reasons.

Gilles Caulier