Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Priority Scheme in the database

Adam_G June 29, 2018

I am trying to discover which projects are using the Default Priority Scheme. Unlike with Default Issue Types or Permission Schemes, you are unable to get a list of projects in the UI which are utilizing the Default Priority Scheme (at least that I have found.) Can anyone point me to a SQL query that I could run to get me the projects utilizing the Default Priority scheme similar to the below:

 

SELECT p.pkey AS ProjectKey,
itss.name AS IssueTypeScreenScheme
FROM project p JOIN nodeassociation na ON p.id = na.source_node_id
JOIN IssueTypeScreenScheme itss ON itss.id=na.sink_node_id
AND sink_node_entity = 'IssueTypeScreenScheme'
AND itss.name = 'Default Issue Type Screen Scheme'

1 answer

1 accepted

2 votes
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 2, 2018

Hello Adam,

I believe this will do the trick for you:

SELECT p.pkey AS "ProjectKey",
f.configname AS "Priority Scheme"
FROM project p,
configurationcontext c,
fieldconfigscheme f
WHERE c.project = p.id
AND f.fieldid='priority'
AND f.id = c.fieldconfigscheme
GROUP BY f.configname, p.pkey
ORDER BY "ProjectKey";

The Query is a bit rough but for a little background on the tables to help refine this a bit, The "fieldconfigurationscheme" table houses the priority scheme name and the "fieldid" column with a value of "priority" is the identifier that this is linked to the priority scheme:

select * from fieldconfigscheme where fieldid='priority';

Then the "configurationcontext" table "project" column is the mapping between the scheme and the project:

select * from configurationcontext where fieldconfigscheme in (select id from fieldconfigscheme where fieldid='priority'); 

-Earl

Alexandre Machado December 1, 2018

Hi !!

How I can found the priorities of each priority scheme ?

Thanks,

Alexandre

Like Pascal Weiller likes this
Rahul Savaikar
Contributor
January 23, 2019

You may directly check the priority table.

select * from priority;

 priority_table.JPG

Like Earl McCutcheon likes this
Yevgen Lasman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 10, 2020

@Alexandre Machado actually priorities and their schemes are linked through the "optionconfiguration" table. Below is an example of SQL for Postgres

select fcs.configname, string_agg(p.pname, ', ' order by p.pname)
from optionconfiguration oc
right join priority p on oc.optionid = p.id
right join fieldconfigscheme fcs on oc.fieldconfig = fcs.id
where oc.fieldid='priority'
group by fcs.configname
order by fcs.configname;
Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events