数据库中的jql信息

时间:2015-06-22 11:50:15

标签: jira jql

这是一个jql查询,我得到了

的结果
assignee in membersOf("project")

这将返回属于项目的成员的问题。

我想知道在jira数据库的哪个表中存储了这个数据(或者哪个成员属于哪个proj的链接)?

1 个答案:

答案 0 :(得分:3)

小组成员

组成员身份存储在CWD_MEMBERSHIP表中。

示例:

SELECT LOWER_CHILD_NAME 
FROM CWD_MEMBERSHIP 
WHERE MEMBERSHIP_TYPE = 'GROUP_USER' 
AND LOWER_PARENT_NAME = 'jira-administrators';

示例2,也是为了获取用户信息:

SELECT
   U.*
FROM
   CWD_MEMBERSHIP M
INNER JOIN CWD_USER U
ON
   M.LOWER_CHILD_NAME = U.LOWER_USER_NAME
WHERE
   M.MEMBERSHIP_TYPE   = 'GROUP_USER' AND
   M.LOWER_PARENT_NAME = 'jira-administrators';

项目角色成员资格

但项目角色成员资格位于PROJECTROLEPROJECTROLEACTOR表中。

示例:

SELECT A.ROLETYPEPARAMETER AS USERNAME, R.NAME AS ROLENAME, P.PKEY || ' - ' || P.PNAME AS PROJECTNAME
FROM PROJECTROLEACTOR A
INNER JOIN PROJECTROLE R ON A.PROJECTROLEID = R.ID
INNER JOIN PROJECT P ON A.PID = P.ID
WHERE P.PKEY = 'YOUR_PKEY_COMES_HERE'
ORDER BY 3, 1, 2;

示例2,获取明确分配给项目角色的用户(而不是通过组):

SELECT A.ROLETYPEPARAMETER AS USERNAME, R.NAME AS ROLENAME, P.PKEY || ' - ' || P.PNAME AS PROJECTNAME
FROM PROJECTROLEACTOR A
INNER JOIN PROJECTROLE R ON A.PROJECTROLEID = R.ID
INNER JOIN PROJECT P ON A.PID = P.ID
INNER JOIN CWD_USER U ON LOWER(A.ROLETYPEPARAMETER) = U.LOWER_USER_NAME
ORDER BY 3, 1, 2;

问题变更记录

要获取问题历史记录,您需要加入changegroup的{​​{1}}和changeitem表格。更改组存储更改时间,更改组包含旧数据和新数据,以及更改的字段。

列出前受让人的示例:

jiraissue

最后一行(最新SELECT CG.AUTHOR AS CHANGE_USER , CG.CREATED AS CHANGE_WHEN , CI.FIELD AS CHANGED_WHAT, CI.OLDVALUE AS CHANGED_FROM, CI.NEWVALUE AS CHANGED_TO FROM JIRAISSUE JI INNER JOIN CHANGEGROUP CG ON JI.ID = CG.ISSUEID INNER JOIN CHANGEITEM CI ON CG.ID = CI.GROUPID WHERE JI.PROJECT = 10100 AND JI.ISSUENUM = 1234 AND CI.FIELDTYPE = 'jira' AND CI.FIELD = 'assignee' ORDER BY CG.CREATED ASC; created必须与newvalue匹配。jiraissue - s值。