The lock only covers one worker, so a deployment running several can
still race. A rollback now moves the ROM back only if this call moved
it, and drops the destination only while it is empty: removal is
recursive, and a folder with anything left in it belongs to the
promotion that won.
Uploading several files fires a request per file, and each one promotes
the same single-file ROM. Both read it as single-file, both clear the
collision check, then one moves the ROM into the new folder and the
other finds nothing at the old path. Its rollback assumed the file at
the destination was its own and moved it back out, leaving the ROM
beside the folder while the database recorded the conversion.
Promotions for a ROM now take a lock and re-read it, so the second
request sees a folder ROM and returns instead of racing.
- Cast year to text in the /api/music years facet search so Postgres does
not error on lower(integer) (MariaDB/SQLite auto-cast, hiding it in CI)
- Escape LIKE wildcards in music search via new utils.database.escape_like
- Drop lazy="selectin" on RomFile.track_meta; eager-load only where the
metadata is serialized (get_rom already did; add the three soundtrack reads)
- Migration backfill uses a single query + fetchmany (repo idiom, see 0084)
instead of manual keyset paging, in both directions
- Guard the extensionless folder-conversion collision (stale row over a
directory the user already created on disk)
- Renumber migration 0093 -> 0094 after 0093_states_rom_user_index landed
- Wrap the filesystem moves (not just the DB write) in the conversion's
rollback so any failure restores the original layout instead of stranding
the file under .romm_tmp_; covered by a new test.
- Use "ROM" rather than "rom" in the convert-to-folder confirm copy.
RomM stores soundtracks but exposes no way to consume them as a music library: a
client has to enumerate ROMs and pull each one's tracks individually, and the
per-track metadata lives in the `rom_files.audio_meta` JSON blob, which is
unindexable on MariaDB, so any library-wide filter or sort degrades to a full
scan.
This adds a queryable, music-first API for soundtracks, backed by a typed and
indexed `track_meta` table migrated from that JSON.
It also lets users upload soundtracks, manuals, and screenshots to any ROM, not
only folder-based ones. When the target is a single-file ROM, the client warns
that the upload will migrate it to a multi-file (folder) structure, then performs
that migration in place automatically.