25 lines
520 B
SQL
25 lines
520 B
SQL
-- name: GetTrackByID :one
|
|
SELECT *
|
|
FROM track
|
|
WHERE id = $1
|
|
LIMIT 1;
|
|
|
|
-- name: AddTrack :one
|
|
INSERT INTO track (path, album_artist, title, album, disc, year, artist, genre, lyrics, composer)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
ON CONFLICT DO NOTHING
|
|
RETURNING *;
|
|
|
|
INSERT INTO artist(name)
|
|
VALUES ($1);
|
|
|
|
-- name: GetAlbumTracks :many
|
|
SELECT *
|
|
FROM track
|
|
WHERE album = $1
|
|
ORDER BY track.title;
|
|
|
|
-- name: Exists :one
|
|
SELECT EXISTS (SELECT 1
|
|
FROM track
|
|
WHERE path = $1) as exists; |