Loggest thy stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.9 KiB

3 years ago
  1. -- name: ListProjectEntries :many
  2. SELECT id, name, status, created_time, author_id FROM project
  3. WHERE scope_id = ?
  4. ORDER BY status, created_time;
  5. -- name: GetProject :one
  6. SELECT * FROM project WHERE id = ?;
  7. -- name: GetProjectRequirement :one
  8. SELECT * FROM project_requirement WHERE id = ?;
  9. -- name: ListProjectRequirementsByProjectID :many
  10. SELECT * FROM project_requirement WHERE project_id = ?;
  11. -- name: ListProjectRequirementStats :many
  12. SELECT prs.required, s.id, s.name, s.weight FROM project_requirement_stat prs
  13. RIGHT JOIN stat s ON s.id = prs.stat_id
  14. WHERE project_requirement_id = ?;
  15. -- name: InsertProject :execresult
  16. INSERT INTO project (scope_id, author_id, name, status, description, created_time)
  17. VALUES (?, ?, ?, ?, ?, ?);
  18. -- name: UpdateProject :exec
  19. UPDATE project
  20. SET name = ?,
  21. status = ?,
  22. description = ?
  23. WHERE id = ?;
  24. -- name: DeleteProject :exec
  25. DELETE FROM project WHERE id = ?;
  26. -- name: InsertProjectRequirement :execresult
  27. INSERT INTO project_requirement (scope_id, project_id, name, status, description)
  28. VALUES (?, ?, ?, ?, ?);
  29. -- name: UpdateProjectRequirement :exec
  30. UPDATE project_requirement
  31. SET name = ?,
  32. status = ?,
  33. description = ?
  34. WHERE id = ?;
  35. -- name: DeleteProjectRequirement :exec
  36. DELETE FROM project_requirement WHERE id = ?;
  37. -- name: DeleteAllProjectRequirements :exec
  38. DELETE FROM project_requirement WHERE project_id = ?;
  39. -- name: ReplaceProjectRequirementStat :exec
  40. REPLACE INTO project_requirement_stat (project_requirement_id, stat_id, required)
  41. VALUES (?, ?, ?);
  42. -- name: DeleteProjectRequirementStat :exec
  43. DELETE FROM project_requirement_stat WHERE project_requirement_id = ? AND stat_id = ?;
  44. -- name: DeleteAllProjectRequirementStats :exec
  45. DELETE FROM project_requirement_stat WHERE project_requirement_id = ?;
  46. -- name: DeleteAllProjectRequirementStatsByStat :exec
  47. DELETE FROM project_requirement_stat WHERE stat_id = ?;