You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
synctv/.sqlx/query-f356ae22ddddbecddee4b...

32 lines
1.1 KiB
JSON

{
"db_name": "PostgreSQL",
"query": "WITH RECURSIVE target_playlists AS (\n SELECT id, 0 AS depth\n FROM playlists\n WHERE room_id = $1\n AND id = ANY($2)\n AND deleted_at IS NULL\n UNION ALL\n SELECT p.id, tp.depth + 1\n FROM playlists p\n JOIN target_playlists tp ON p.parent_id = tp.id\n WHERE p.room_id = $1\n AND p.deleted_at IS NULL\n )\n SELECT id AS \"id!: PlaylistId\", MAX(depth) AS depth\n FROM target_playlists\n GROUP BY id\n ORDER BY MAX(depth) DESC, id",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id!: PlaylistId",
"type_info": "Int8",
"origin": "Expression"
},
{
"ordinal": 1,
"name": "depth",
"type_info": "Int4",
"origin": "Expression"
}
],
"parameters": {
"Left": [
"Int8",
"Int8Array"
]
},
"nullable": [
null,
null
]
},
"hash": "f356ae22ddddbecddee4bace8bd74081385aa75613c8258ea2514a6e14bfe6bb"
}