28 lines
1.1 KiB
JSON
28 lines
1.1 KiB
JSON
|
{
|
||
|
"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"
|
||
|
}
|