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/.sqlx/query-595739c03acbe706107e34a3ebebec8c8f21f70ccc51b5366eff962d9af391d7.json

28 lines
1.1 KiB
JSON
Raw Normal View History

2024-07-30 17:21:33 +00:00
{
"db_name": "PostgreSQL",
"query": "WITH RECURSIVE folder_hierarchy AS (\n -- Start with the given directory\n SELECT \n folder_id \n FROM \n folders \n WHERE \n folder_id = $1\n\n UNION ALL\n\n -- Recursively find all subdirectories\n SELECT \n f.folder_id\n FROM \n folders f\n INNER JOIN \n folder_hierarchy fh ON f.parent_folder_id = fh.folder_id\n)\nINSERT INTO permissions(user_id, folder_id, permission_type)\nSELECT $2::integer as user_id, fh.folder_id::UUID as folder_id, $3\nFROM folder_hierarchy fh\nON CONFLICT (user_id, folder_id) DO UPDATE\nSET permission_type = $3",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Uuid",
"Int4",
{
"Custom": {
"name": "permission",
"kind": {
"Enum": [
"read",
"write",
"manage"
]
}
}
}
]
},
"nullable": []
},
"hash": "595739c03acbe706107e34a3ebebec8c8f21f70ccc51b5366eff962d9af391d7"
}