-- name: CreateTicket :one
INSERT INTO tickets (
    key, project_git, build_git, folder, created_at
) VALUES (
    $1, $2, $3, $4, $5
    )
    RETURNING *;

-- name: ListTickets :many
SELECT * FROM tickets WHERE deleted_at IS NULL;

-- name: ListTicketsWithDeleted :many
SELECT * FROM tickets;

-- name: GetTicketByID :one
SELECT * FROM tickets WHERE id = $1;

-- name: UpdateTicketByID :exec
UPDATE tickets SET project_git = $1, build_git = $2, folder = $3 WHERE id = $4;

-- name: DeleteTicketByID :exec
UPDATE tickets SET deleted_at = current_timestamp WHERE id = $1;

-- name: DeleteTicketByKey :exec
UPDATE tickets SET deleted_at = current_timestamp WHERE key = $1;