How to find the last time a review was created or updated inside each Crucible project from the database

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.

You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.

We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!

Purpose

I want to find out when was the last time that a review was created inside my Crucible projects. I need to do this because...

  • I want to review recent activity in certain projects.
  • I want to know how often people create new reviews in Crucible.
  • I want to check if any reviews were creating in the last X number of days.
  • I want to check when was the last time a review was updated on a Crucible Project.

Those are just a few examples of use case scenarios.

Solution

Find the recent review created date for each project

This information cannot be found from the Crucible UI, but can be found by querying the Crucible database.

The following SELECT will give you a list of Crucible projects containing the project key and name as well as the last time a review was created inside each one of them.

PostgreSQL 9.6
select distinct on (CP.CRU_PROJ_KEY) CP.CRU_PROJ_KEY PROJ_KEY,
       CP.CRU_NAME PROJECT_NAME,
       TO_CHAR(TO_TIMESTAMP(CR.CRU_CREATE_DATE / 1000), 'DD-MM-YYYY HH24:MI:SS') LAST_REVIEW_CREATED_ON
  from CRU_REVIEW CR
  join CRU_PROJECT CP
    on CR.CRU_PROJECT = CP.CRU_PROJECT_ID
 order by CP.CRU_PROJ_KEY, CR.CRU_CREATE_DATE DESC;

The SELECT query was built for PostgreSQL 9.6. You may need to adjust it to work with other databases e.g. Oracle, MySQL and etc.

Results will look similar to the following:

PROJ_KEYPROJECT_NAMELAST_REVIEW_CREATED_ON
CRDefault Project10-12-2020 08:15:45
PROJMy Project16-12-2020 10:43:08
TESTTesting Project24-11-2020 06:37:50
HELLOHello Project06-07-2019 07:21:35
SQLSQL Project17-03-2018 12:15:08
GITGit Project14-03-2018 02:45:01


Find the recent review updated date for each project

If you are looking to find out the most recent date when a review was updated on a project then the below query can be used.

Postgres
SELECT DISTINCT ON (CP.CRU_PROJ_KEY) CP.CRU_PROJ_KEY PROJ_KEY,
       CP.CRU_NAME PROJECT_NAME,
       TO_CHAR(TO_TIMESTAMP(CSC.CRU_TIME_STAMP / 1000), 'DD-MM-YYYY HH24:MI:SS') REVIEW_LAST_UPDATED_ON
  FROM CRU_REVIEW CR
  JOIN CRU_PROJECT CP
    ON CR.CRU_PROJECT = CP.CRU_PROJECT_ID
  JOIN CRU_STATE_CHANGE CSC ON CR.CRU_REVIEW_ID = CSC.CRU_REVIEW_ID
 ORDER BY CP.CRU_PROJ_KEY, CSC.CRU_TIME_STAMP DESC;

Results will look similar to the following:

PROJ_KEYPROJECT_NAMEREVIEW_LAST_UPDATED_ON
CRDefault Project10-12-2020 08:15:45
PROJMy Project16-12-2020 10:43:08
TESTTesting Project24-11-2020 06:37:50
HELLOHello Project06-07-2019 07:21:35
SQLSQL Project17-03-2018 12:15:08
GITGit Project14-03-2018 02:45:01


You can export it to a CSV file to sort through the results and see when was the last time reviews were created or updated inside your Crucible projects.


DescriptionHow to find the last time a review was created inside each Crucible project from the database
ProductFisheye, Crucible

Last modified on Aug 19, 2022

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.