fix(migrations): use SHA-256 instead of MD5 for the enclosures unique index
PostgreSQL 18 disables MD5 when running in FIPS mode, which made
md5(url) unusable. This broke enclosure creation with:
store: unable to create enclosure: pq: could not compute MD5
hash: unsupported (XX000)
Replace md5(url) with encode(sha256(url::bytea), 'hex') everywhere:
- The historical migrations that created the enclosures index are
changed to sha256 so fresh installs no longer fail while replaying
them on FIPS-mode PostgreSQL 18.
- A new migration rebuilds enclosures_user_entry_url_unique_idx with
sha256 to convert existing installs.
- The ON CONFLICT clause in createEnclosure is updated to match the
new expression index.
According to `openssl speed -bytes 256 md5 sha256`, this is a performance
improvement as well :D
Finally, the PostgreSQL minimum version was bumped from 9.5 to 11, the lowest
version to support SHA256.
Fixes #4350 J
jvoisin committed
f22c08832a6c8a7a07f8e34b4f4b4ec4114fb952
Parent: f4de355
Committed by fguillot <323546+fguillot@users.noreply.github.com>
on 6/10/2026, 4:00:27 AM