Skip to content

Commit 1b72680

Browse files
Updated transactions.sql for relevant transaction sturture till now (need to update this after transactions final struct is declared)
1 parent 7a4c243 commit 1b72680

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

db/queries/transactions.sql

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,40 @@
1-
-- name: CreateTransaction :one
1+
-- name: StoreTransactionPQ :one
22
INSERT INTO transactions_archive (
3-
id, session_id, status, output, created_at
3+
id, session_id, action, resource, permissions, status, error, output, created_at
44
) VALUES (
5-
$1, $2, $3, $4, $5
5+
$1, $2, $3, $4, $5, $6, $7, $8, $9
66
) RETURNING *;
77

8-
-- name: GetTransaction :one
8+
-- name: GetTransactionPQ :one
99
SELECT * FROM transactions_archive
1010
WHERE id = $1;
1111

12-
-- name: GetTransactionsBySession :many
12+
-- name: GetTransactionsBySessionPQ :many
1313
SELECT * FROM transactions_archive
1414
WHERE session_id = $1
1515
ORDER BY created_at DESC;
1616

17-
-- name: GetSuccessfulTransactions :many
17+
-- name: GetSuccessfulTransactionsPQ :many
1818
SELECT * FROM transactions_archive
1919
WHERE session_id = $1 AND status = 'success'
2020
ORDER BY created_at DESC;
2121

22-
-- name: GetFailedTransactions :many
23-
SELECT * FROM transactions_archive
24-
WHERE session_id = $1 AND status = 'failure'
25-
ORDER BY created_at DESC;
22+
-- name: GetFailedTransactionsPQ :many
23+
select * from transactions_archive
24+
where session_id = $1 and status = 'failure'
25+
order by created_at desc;
26+
27+
-- name: GetPendingTransactionsPQ :many
28+
select * from transactions_archive
29+
where session_id = $1 and status = 'pending'
30+
order by created_at desc;
2631

27-
-- name: DeleteTransaction :exec
32+
-- name: DeleteTransactionPQ :exec
2833
DELETE FROM transactions_archive WHERE id = $1;
2934

30-
-- name: DeleteTransactionsBySession :exec
35+
-- name: DeleteTransactionsBySessionPQ :exec
3136
DELETE FROM transactions_archive WHERE session_id = $1;
3237

33-
-- name: CountTransactionsByStatus :one
38+
-- name: CountTransactionsByStatusPQ :one
3439
SELECT COUNT(*) FROM transactions_archive
3540
WHERE session_id = $1 AND status = $2;

0 commit comments

Comments
 (0)