This repository has been archived on 2024-08-23. You can view files and clone it, but cannot push or open issues or pull requests.
project/sql/delete_user.sql
2024-07-30 20:26:31 +03:00

16 lines
329 B
SQL

WITH
deleted_files AS (
DELETE FROM files USING folders
WHERE
files.folder_id = folders.folder_id
AND folders.owner_id = $1 RETURNING files.file_id
),
deleted_users AS (
DELETE FROM users
WHERE
user_id = $1
)
SELECT
*
FROM
deleted_files;