Uploads skip per-gallery duplicates, checksums can be backfilled, and STORAGE_BACKEND plus sync tooling make switching storage backends safe.
9 lines
526 B
SQL
9 lines
526 B
SQL
-- Content hash of the stored original, for per-gallery duplicate detection on
|
|
-- upload. NULL means "not hashed yet" — rows predating this migration, until
|
|
-- `photo-api backfill-checksums` runs. NULLs are distinct under a unique
|
|
-- index, so those rows never collide with each other.
|
|
-- (No semicolons in these comments: the migration runner splits on them.)
|
|
ALTER TABLE photos_photos ADD COLUMN checksum text;
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS photos_photos_gallery_checksum_idx ON photos_photos (gallery_id, checksum);
|