feat(10-02): add sqlc queries for libraries and update playlist queries for phantom support
- Create libraries.sql with 7 CRUD queries (create, get, get-by-path, list, update, delete, count) - Update playlists.sql: AddPlaylistTrack now accepts 9 params including phantom metadata - Update playlist queries to use LEFT JOIN for nullable audio_file_id - Add GetTrackPhantomMetadata helper query for eager phantom population - Add is_phantom computed column to metadata queries - Add GetAudioFilesByLibrary and CountAudioFilesByLibrary queries - Regenerate all sqlc code
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
-- name: CreateLibrary :one
|
||||
INSERT INTO libraries (name, path) VALUES (?, ?)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetLibrary :one
|
||||
SELECT * FROM libraries WHERE id = ? LIMIT 1;
|
||||
|
||||
-- name: GetLibraryByPath :one
|
||||
SELECT * FROM libraries WHERE path = ? LIMIT 1;
|
||||
|
||||
-- name: GetAllLibraries :many
|
||||
SELECT * FROM libraries ORDER BY name;
|
||||
|
||||
-- name: UpdateLibraryName :exec
|
||||
UPDATE libraries SET name = ? WHERE id = ?;
|
||||
|
||||
-- name: DeleteLibrary :exec
|
||||
DELETE FROM libraries WHERE id = ?;
|
||||
|
||||
-- name: CountLibraries :one
|
||||
SELECT COUNT(*) AS count FROM libraries;
|
||||
Reference in New Issue
Block a user