2024-07-15 22:30:32 -04:00
|
|
|
-- name: AddCall :one
|
|
|
|
INSERT INTO calls (
|
|
|
|
id,
|
|
|
|
submitter,
|
|
|
|
system,
|
|
|
|
talkgroup,
|
2024-07-16 19:35:16 -04:00
|
|
|
call_date,
|
2024-07-15 22:30:32 -04:00
|
|
|
audio_name,
|
|
|
|
audio_blob,
|
|
|
|
audio_type,
|
|
|
|
audio_url,
|
2024-08-11 13:46:43 -04:00
|
|
|
duration,
|
2024-07-16 19:31:30 -04:00
|
|
|
frequency,
|
2024-07-15 22:30:32 -04:00
|
|
|
frequencies,
|
|
|
|
patches,
|
|
|
|
tg_label,
|
2024-08-23 14:28:47 -04:00
|
|
|
tg_alpha_tag,
|
2024-07-27 19:25:16 -04:00
|
|
|
tg_group,
|
2024-07-15 22:30:32 -04:00
|
|
|
source
|
2024-08-11 13:46:43 -04:00
|
|
|
) VALUES (gen_random_uuid(), $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)
|
2024-07-28 09:01:30 -04:00
|
|
|
RETURNING id;
|
2024-07-16 19:31:30 -04:00
|
|
|
|
2024-07-17 19:33:09 -04:00
|
|
|
-- name: SetCallTranscript :exec
|
2024-07-16 19:31:30 -04:00
|
|
|
UPDATE calls SET transcript = $2 WHERE id = $1;
|
2024-10-20 12:26:32 -04:00
|
|
|
|
2024-11-01 09:15:39 -04:00
|
|
|
-- name: AddAlert :exec
|
2024-11-02 09:41:48 -04:00
|
|
|
INSERT INTO alerts (id, time, talkgroup, weight, score, orig_score, metadata)
|
2024-11-01 09:15:39 -04:00
|
|
|
VALUES
|
|
|
|
(
|
|
|
|
sqlc.arg(id),
|
|
|
|
sqlc.arg(time),
|
|
|
|
sqlc.arg(packed_tg),
|
|
|
|
sqlc.arg(weight),
|
|
|
|
sqlc.arg(score),
|
2024-11-02 09:41:48 -04:00
|
|
|
sqlc.arg(orig_score),
|
2024-11-01 09:15:39 -04:00
|
|
|
sqlc.arg(metadata)
|
|
|
|
);
|
|
|
|
|
2024-10-20 13:04:42 -04:00
|
|
|
-- name: GetDatabaseSize :one
|
|
|
|
SELECT pg_size_pretty(pg_database_size(current_database()));
|