Files
photos/migrations/0002_content_hash.sql
nils 6259ca84d8
ci / docker (push) Successful in 12s
Content dedup on both sides, stored checksums, spool-free zips, upload stats
- sha256+crc32 hashed during upload streaming; unique index per album
- duplicate content returns the existing photo (race-safe via 23505)
- client hashes locally (WebCrypto) and skips the transfer entirely for
  content the album already has
- zip downloads stream S3->response directly using the stored crc32;
  pre-hash photos spool once and self-heal (crc via zip, sha via reprocess)
- upload UI: overall progress bar, bytes, live speed, ETA
2026-07-17 14:41:07 +02:00

11 lines
543 B
SQL

-- Content hashes: sha256 powers duplicate-upload detection (same content in
-- the same album is returned instead of copied); crc32 lets zip downloads
-- stream originals straight from S3 without a local spool pass.
-- Both are null for photos uploaded before this migration; they self-heal on
-- reprocess (sha256 + crc32) and on zip download (crc32).
alter table photos add column sha256 text;
alter table photos add column crc32 bigint;
create unique index photos_album_sha_uidx on photos (album_id, sha256)
where sha256 is not null;