From cf66c7db0a39ec379ba192036581cc72da513917 Mon Sep 17 00:00:00 2001 From: xenofem Date: Wed, 7 Feb 2024 00:09:42 -0500 Subject: [PATCH] make author relations and tag relations unique in db schema --- dlibrary/dlibrary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 3d313b5..635157c 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -101,8 +101,8 @@ async def fetch_async(args): cur = con.cursor() cur.execute("CREATE TABLE IF NOT EXISTS works(id TEXT PRIMARY KEY, title TEXT, circle TEXT, date TEXT, description TEXT, series TEXT, virtual INT)") - cur.execute("CREATE TABLE IF NOT EXISTS authors(author TEXT, work TEXT, FOREIGN KEY(work) REFERENCES works(id))") - cur.execute("CREATE TABLE IF NOT EXISTS tags(tag TEXT, work TEXT, FOREIGN KEY(work) REFERENCES works(id))") + cur.execute("CREATE TABLE IF NOT EXISTS authors(author TEXT, work TEXT, FOREIGN KEY(work) REFERENCES works(id), PRIMARY KEY(author, work))") + cur.execute("CREATE TABLE IF NOT EXISTS tags(tag TEXT, work TEXT, FOREIGN KEY(work) REFERENCES works(id), PRIMARY KEY(tag, work))") thumbnails_dir = args.destdir / 'site' / 'thumbnails' thumbnails_dir.mkdir(parents=True, exist_ok=True)