mirror of
https://github.com/immich-app/immich.git
synced 2025-01-01 08:31: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:
parent
4bb7d2df49
commit
3c7b8d560f
1 changed files with 11 additions and 1 deletions
|
@ -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)"
|
```sql title="Find by checksum (SHA-1)"
|
||||||
SELECT encode("checksum", 'hex') FROM "assets";
|
SELECT encode("checksum", 'hex') FROM "assets";
|
||||||
SELECT * FROM "assets" WHERE "checksum" = decode('69de19c87658c4c15d9cacb9967b8e033bf74dd1', 'hex');
|
SELECT * FROM "assets" WHERE "checksum" = decode('69de19c87658c4c15d9cacb9967b8e033bf74dd1', 'hex');
|
||||||
|
SELECT * FROM "assets" WHERE "checksum" = '\x69de19c87658c4c15d9cacb9967b8e033bf74dd1'; -- alternate notation
|
||||||
```
|
```
|
||||||
|
|
||||||
```sql title="Live photos"
|
```sql title="Live photos"
|
||||||
SELECT * FROM "assets" WHERE "livePhotoVideoId" IS NOT NULL;
|
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"
|
```sql title="Without metadata"
|
||||||
SELECT "assets".* FROM "exif"
|
SELECT "assets".* FROM "exif"
|
||||||
LEFT JOIN "assets" ON "assets"."id" = "exif"."assetId"
|
LEFT JOIN "assets" ON "assets"."id" = "exif"."assetId"
|
||||||
|
@ -94,5 +104,5 @@ SELECT "key", "value" FROM "system_config";
|
||||||
## Persons
|
## Persons
|
||||||
|
|
||||||
```sql title="Delete person and unset it for the faces it was associated with"
|
```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';
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue