diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/App/MediaControl/DB.rakumod | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/App/MediaControl/DB.rakumod b/lib/App/MediaControl/DB.rakumod index cfa2dc3..5f67bb6 100644 --- a/lib/App/MediaControl/DB.rakumod +++ b/lib/App/MediaControl/DB.rakumod @@ -27,12 +27,12 @@ class App::MediaControl::DB { id INTEGER PRIMARY KEY, parent_id INTEGER NULL REFERENCES files(id) ON DELETE CASCADE, - matpath TEXT NOT NULL, + path TEXT NOT NULL, name TEXT NOT NULL, is_dir BOOLEAN NOT NULL, watched_time INTEGER NULL, seen BOOLEAN NOT NULL DEFAULT false, - UNIQUE (matpath, name) + UNIQUE (path, name) ) END } @@ -63,17 +63,17 @@ class App::MediaControl::DB { self!db: { .query(q:to/END/, :$path, :$name, :is_dir($is-dir)); WITH parent(id,path) AS ( - SELECT id, matpath || name || '/' FROM files + SELECT id, path || name || '/' FROM files ), newrow(path,name,is_dir) AS ( VALUES($path, $name, $is_dir) ) - INSERT INTO files(parent_id,matpath,name,is_dir,seen) + INSERT INTO files(parent_id,path,name,is_dir,seen) SELECT id, newrow.path, name, is_dir, true FROM newrow LEFT JOIN parent ON parent.path=newrow.path WHERE true - ON CONFLICT (matpath,name) DO UPDATE SET seen=true + ON CONFLICT (path,name) DO UPDATE SET seen=true END } } @@ -87,7 +87,7 @@ class App::MediaControl::DB { .query(q:to/END/, :$path, :$name); DELETE FROM files WHERE name=$name - AND matpath=$path + AND path=$path END } } @@ -111,7 +111,7 @@ class App::MediaControl::DB { method get-entry(Int:D() $id) { self!db: { .query(q:to/END/,$id).hash; - SELECT id, matpath, name, is_dir + SELECT id, path, name, is_dir FROM files WHERE id=$id END |