mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
Key the unique roms index on a sha256 digest of the full path. Indexing (platform_id, fs_path, fs_name) directly is 5804 bytes of utf8mb4, which MySQL rejects with ER_TOO_LONG_KEY and MariaDB silently demotes to a hash index; the digest column keeps it a 260-byte BTREE on every supported driver. It is derived by the same @validates hook that maintains the other fs_name columns, and resynced explicitly in update_rom and convert_rom_to_folder. Migration 0126 backfills the digest in one dialect-branched UPDATE. A Python executemany right after the ADD COLUMN silently applies only its first parameter set on mariadb-connector, leaving the rest NULL. test_migrations pins the SQL expression to compute_full_path_hash so the two cannot drift. Drop the relocation pre-pass. mark_missing_roms already runs before the identify loop, so a moved file reaches get_matching_missing_rom, which requires all three hashes to agree (or a title_id, covering non-hashable platforms), refuses ambiguous matches, re-parses filename tags and emits over the socket. The pre-pass duplicated it with a weaker CRC-only check, hashed every candidate twice, compared folder sizes against a total that excludes filtered files, and ran on QUICK scans. Send uploads to a folder the platform's structure will actually discover, so the next scan does not flag a fresh upload as missing, and refuse with a 400 when only the user can pick the folder. Make 0126's downgrade refuse when duplicate file names exist instead of deleting the roms (and their saves, notes and collection membership) that carry them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>