mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-24 05:28:36 -06:00
28 lines
834 B
SQL
28 lines
834 B
SQL
-- name: ExecutionsServiceGetExecutionForSoftDelete :one
|
|
SELECT
|
|
executions.id as execution_id,
|
|
executions.path as execution_path,
|
|
|
|
backups.id as backup_id,
|
|
|
|
destinations.bucket_name as destination_bucket_name,
|
|
destinations.region as destination_region,
|
|
destinations.endpoint as destination_endpoint,
|
|
pgp_sym_decrypt(
|
|
destinations.access_key::bytea, @encryption_key
|
|
) AS decrypted_destination_access_key,
|
|
pgp_sym_decrypt(
|
|
destinations.secret_key::bytea, @encryption_key
|
|
) AS decrypted_destination_secret_key
|
|
FROM executions
|
|
JOIN backups ON backups.id = executions.backup_id
|
|
JOIN destinations ON destinations.id = backups.destination_id
|
|
WHERE executions.id = @execution_id;
|
|
|
|
-- name: ExecutionsServiceSoftDeleteExecution :exec
|
|
UPDATE executions
|
|
SET
|
|
status = 'deleted',
|
|
deleted_at = NOW()
|
|
WHERE id = @id;
|