|
Try adding SQL Logging for a great way to watch JIRA database queries in action. |
|
Help contribute to our examples at Example SQL queries for JIRA. |
JIRA uses Entity Engine module of the OfBiz suite to communicate with the database. You can learn more about the Entity Engine by reading its online documentation.
The database schema is described in the entitymodel.xml found in the WEB-INF/classes/entitydefs directory under the JIRA web application. The entitymodel.xml file has an XML definition of all JIRA's database tables, table columns and their data type. Some of the relationships between tables also appear in the file.
If you are using JIRA's API you will notice that a lot of code deals with GenericValue objects. The GenericValue is an OfBiz entity engine object. Each GenericValue object represents a record in the database.
To get a value of a field from a GenericValue you will need to use the relevant getter method for the field's type. For example:
GenericValue project = ...
String name = project.getString("name");
Long id = project.getLong("id");
|
The list of valid fields for each entity can be obtained by looking the entity's definition in the WEB-INF/classes/entitydefs/entitymodel.xml file. For the above example, one needs to look at the "Project" entity.
Some of the relationships between JIRA's tables in the database are documented below:
Work log entries are kept in the worklog table. For instance, some worklogs in JIRA (from JRA-10393):

are stored in worklog table as:
ID |
issueid |
author |
grouplevel |
rolelevel |
worklogbody |
created |
updateauthor |
updated |
timeworked |
startdate |
|---|---|---|---|---|---|---|---|---|---|---|
83332 |
38315 |
mtokar |
|
|
Implemented method to calculate number of active users + tests |
2008-01-22 19:44:04.867-06 |
mtokar |
2008-01-22 19:44:04.867-06 |
5400 |
2008-01-22 19:43:00-06 |
83333 |
38315 |
andreask@atlassian.com |
|
|
Implemented a method to check if the user limit of the license has been exceeded. |
2008-01-22 21:33:18.23-06 |
andreask@atlassian.com |
2008-01-22 21:33:18.23-06 |
7200 |
2008-01-22 21:31:00-06 |
83334 |
38315 |
andreask@atlassian.com |
|
|
Added new license types |
2008-01-22 23:49:27.794-06 |
andreask@atlassian.com |
2008-01-22 23:51:06.029-06 |
7200 |
2008-01-22 23:48:00-06 |
83335 |
38315 |
andreask@atlassian.com |
|
|
Integrate new license types in JIRA. |
2008-01-22 23:51:23.799-06 |
andreask@atlassian.com |
200 |
ここで:
issueid maps to jiraissue.idtimeworked is in secondsWhenever a worklog entry is added, the jiraissue.timespent and jiraissue.timeestimate values are incremented and decremented respectively.
Some examples of SQLs that can be run against the JIRA schema:
Example SQL queries for JIRA