From 02dc20f93ed870bf370f7b7efdd3f452ee6fdfa8 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Mon, 18 Aug 2025 02:11:26 +0800 Subject: Move sql to inside forged --- sql/queries/groups.sql | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 sql/queries/groups.sql (limited to 'sql/queries') diff --git a/sql/queries/groups.sql b/sql/queries/groups.sql deleted file mode 100644 index 07fe5e7..0000000 --- a/sql/queries/groups.sql +++ /dev/null @@ -1,27 +0,0 @@ --- name: GetGroupIDDescByPath :one -WITH RECURSIVE group_path_cte AS ( - SELECT - id, - parent_group, - name, - 1 AS depth - FROM groups - WHERE name = ($1::text[])[1] - AND parent_group IS NULL - - UNION ALL - - SELECT - g.id, - g.parent_group, - g.name, - group_path_cte.depth + 1 - FROM groups g - JOIN group_path_cte ON g.parent_group = group_path_cte.id - WHERE g.name = ($1::text[])[group_path_cte.depth + 1] - AND group_path_cte.depth + 1 <= cardinality($1::text[]) -) -SELECT c.id, COALESCE(g.description, '') -FROM group_path_cte c -JOIN groups g ON g.id = c.id -WHERE c.depth = cardinality($1::text[]); -- cgit v1.2.3