venue.sql 657 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- name: ListVenues :many
  2. SELECT *
  3. FROM venue
  4. WHERE city = $1
  5. ORDER BY name;
  6. -- name: DeleteVenue :exec
  7. DELETE FROM venue
  8. WHERE slug = $1 AND slug = $1;
  9. -- name: GetVenue :one
  10. SELECT *
  11. FROM venue
  12. WHERE slug = $1 AND city = $2;
  13. -- name: CreateVenue :one
  14. INSERT INTO venue (
  15. slug,
  16. name,
  17. city,
  18. created_at,
  19. spotify_playlist,
  20. status,
  21. statuses,
  22. tags
  23. ) VALUES (
  24. $1,
  25. $2,
  26. $3,
  27. NOW(),
  28. $4,
  29. $5,
  30. $6,
  31. $7
  32. ) RETURNING id;
  33. -- name: UpdateVenueName :one
  34. UPDATE venue
  35. SET name = $2
  36. WHERE slug = $1
  37. RETURNING id;
  38. -- name: VenueCountByCity :many
  39. SELECT
  40. city,
  41. count(*)
  42. FROM venue
  43. GROUP BY 1
  44. ORDER BY 1;