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

16 lines
329 B
MySQL
Raw Normal View History

2024-07-30 17:21:33 +00:00
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;