-- 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;
