feat: LibraryItem.requestId nullable (scanned haves need no request) + test cleanup

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan
2026-07-11 16:56:59 +02:00
parent 446d54f819
commit af67d01aa2
5 changed files with 20 additions and 2 deletions
@@ -0,0 +1,13 @@
def test_library_item_can_have_null_request(conn):
with conn.cursor() as cur:
cur.execute(
'INSERT INTO "LibraryItem" (id, "requestId", artist, album, path, source, format, '
'"qualityClass", "importedAt") '
"VALUES (gen_random_uuid()::text, NULL, 'A', 'B', '/m/A/B', 'scan', 'FLAC', 2, now()) "
"RETURNING id"
)
lib_id = cur.fetchone()[0]
conn.commit()
with conn.cursor() as cur:
cur.execute('SELECT "requestId" FROM "LibraryItem" WHERE id = %s', (lib_id,))
assert cur.fetchone()[0] is None