move queries to db folder, change database to better accommodate musicbrainz api data

This commit is contained in:
Chiel Suttorp
2026-03-26 16:31:38 +01:00
parent e69ac3a305
commit e3176871ab
6 changed files with 21 additions and 7 deletions
+18
View File
@@ -0,0 +1,18 @@
-- artists.sql
-- name: GetArtistByID :one
SELECT * FROM artists WHERE id = $1;
-- name: GetAllArtists :many
SELECT * FROM artists;
-- name: CreateArtist :one
INSERT INTO artists (id, name, genre, bio, artist_image_url) VALUES ($1, $2, $3, $4, $5) RETURNING id;
-- name: UpdateArtist :exec
UPDATE artists SET name = $2, genre = $3, bio = $4, artist_image_url = $5 WHERE id = $1;
-- name: DeleteArtist :exec
DELETE FROM artists WHERE id = $1;
-- name: SearchArtists :many
SELECT * FROM artists WHERE name ILIKE '%' || $1 || '%' OR genre ILIKE '%' || $1 || '%';