mmm/internal/db/queries/track.sql

25 lines
520 B
MySQL
Raw Permalink Normal View History

2024-06-30 17:27:01 +02:00
-- 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;