1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2024-12-28 22:51:59 +00:00

docs: update queries for descriptions (#9144)

* update queries for descriptions

* join to assets

* specify exif.

* Update database-queries.md

LEFT JOIN not needed here

* Update database-queries.md

* Update database-queries.md
This commit is contained in:
Matthew Momjian 2024-04-28 19:15:32 -04:00 committed by GitHub
parent 4bb7d2df49
commit 3c7b8d560f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,12 +34,22 @@ You can calculate the checksum for a particular file by using the command `sha1s
```sql title="Find by checksum (SHA-1)"
SELECT encode("checksum", 'hex') FROM "assets";
SELECT * FROM "assets" WHERE "checksum" = decode('69de19c87658c4c15d9cacb9967b8e033bf74dd1', 'hex');
SELECT * FROM "assets" WHERE "checksum" = '\x69de19c87658c4c15d9cacb9967b8e033bf74dd1'; -- alternate notation
```
```sql title="Live photos"
SELECT * FROM "assets" WHERE "livePhotoVideoId" IS NOT NULL;
```
```sql title="By description"
SELECT "assets".*, "exif"."description" FROM "exif"
JOIN "assets" ON "assets"."id" = "exif"."assetId"
WHERE TRIM("exif"."description") <> ''; -- all files with a description
SELECT "assets".*, "exif"."description" FROM "exif"
JOIN "assets" ON "assets"."id" = "exif"."assetId"
WHERE "exif"."description" ILIKE '%string to match%'; -- search by string
```
```sql title="Without metadata"
SELECT "assets".* FROM "exif"
LEFT JOIN "assets" ON "assets"."id" = "exif"."assetId"
@ -94,5 +104,5 @@ SELECT "key", "value" FROM "system_config";
## Persons
```sql title="Delete person and unset it for the faces it was associated with"
DELETE FROM person WHERE name = 'PersonNameHere';
DELETE FROM "person" WHERE "name" = 'PersonNameHere';
```