Database schema: jcr

DBMS: postgres8

Schema for the Java Code Review tool (JCR)

Full schema diagram

Table Index
filecommentprojectprojectfileprojectthread
filesetprojectcommentprojectstatussystemuser

Sequence Index
tableids

Table: systemuser
Records details of a user authorised to use JCR
Columns
NameTypeConstraintsDescription
systemidINTEGERNOT NULLSystem-generated primary key
usernameVARCHAR (20)NOT NULLThe name by which the user is identified to the system. Must be unique
nameVARCHAR (50)NOT NULLFull name of the user
issuperuserCHAR (1)NOT NULLContains Y if this is the sole superuser, otherwise N
passwordVARCHAR (32)NOT NULLUser's password, salted with the username and MD5 hashed
emailVARCHAR (100)User's email address (currently not used)
enabledCHAR (1)NOT NULLContains Y if the user may log in, otherwise N
Primary key
NameColumnsDescription
pk_systemusersystemid
Incoming foreign keys
NameColumnsReferencing tableDescription
fk_fileset_systemuserownerfileset
fk_project_systemuserownerproject
fk_projectstatus_changedBychangedbyprojectstatus
fk_projectthread_systemuserownerprojectthread
fk_projectcomment_systemuser_ownerownerprojectcomment
fk_projectcom_systemuser_reviewerreviewerprojectcomment
fk_projectcom_systemuser_revactionreviewactionownerprojectcomment
fk_projectcom_systemuser_actioneractionerprojectcomment
fk_filecomment_systemuser_ownerownerfilecomment
fk_filecom_systemuser_reviewerreviewerfilecomment
fk_filecom_systemuser_revactionreviewactionownerfilecomment
fk_filecom_systemuser_actioneractionerfilecomment

Table: fileset
Represents a set of files that can be used by one or more review projects.
Each set can be either uploaded as a tarball, or extracted from source control
Columns
NameTypeConstraintsDescription
systemidINTEGERNOT NULLSystem-generated primary key
ownerINTEGERNOT NULLThe SystemUser who created the file set
createdateTIMESTAMPNOT NULLCreation/last modification time of the file set
directoryVARCHAR (500)Directory relative to JCR root containing all files
baselineVARCHAR (500)Name of baseline in source control (optional, but recommended)
Primary key
NameColumnsDescription
pk_filesetsystemid
Foreign keys
NameColumnsReferenced tableDescription
fk_fileset_systemuserownersystemuser
Incoming foreign keys
NameColumnsReferencing tableDescription
fk_project_originalfilesetoriginalfilesetproject
fk_project_modifiedfilesetmodifiedfilesetproject

Table: project
Represents a code review project
Columns
NameTypeConstraintsDescription
systemidINTEGERNOT NULLSystem-generated primary key
nameVARCHAR (100)NOT NULLDisplay name for the project
ownerINTEGERNOT NULLThe SystemUser who created (and owns) the project
createdateTIMESTAMPNOT NULLCreation time of the project
directoryVARCHAR (200)NOT NULLDirectory (relative to JCR root) containing all project files
currentstatusVARCHAR (10)NOT NULLCurrent status of the project. Values are:
SI: Setup - initial
SD: Setup - generating diffs
SF: Setup - selecting files
RP: Review - preparation
RM: Review - meeting
C: Complete
originalfilesetINTEGERFileset with original versions of all files in the project, i.e. the before snapshot
modifiedfilesetINTEGERFileset with modified versions of all files in the project, i.e. the after snapshot
notesTEXTFree-form notes from the project owner, to assist reviewers
Primary key
NameColumnsDescription
pk_projectsystemid
Foreign keys
NameColumnsReferenced tableDescription
fk_project_systemuserownersystemuser
fk_project_originalfilesetoriginalfilesetfileset
fk_project_modifiedfilesetmodifiedfilesetfileset
Incoming foreign keys
NameColumnsReferencing tableDescription
fk_projectstatus_projectprojectprojectstatus
fk_projectthread_projectprojectprojectthread
fk_projectfile_projectprojectprojectfile

Table: projectstatus
Records the history of status changes to each project
Columns
NameTypeConstraintsDescription
systemidINTEGERNOT NULLSystem-generated primary key
projectINTEGERNOT NULLThe project whose state was changed
changedbyINTEGERNOT NULLThe SystemUser who changed the status of the project
changedateTIMESTAMPNOT NULLTime when the project status was changed
newstatusVARCHAR (2)NOT NULLNew status of the project. See Project.currentStatus for details
Primary key
NameColumnsDescription
pk_projectstatussystemid
Foreign keys
NameColumnsReferenced tableDescription
fk_projectstatus_projectprojectproject
fk_projectstatus_changedBychangedbysystemuser

Table: projectthread
Groups together project-level comments with a common title, like an email thread
Columns
NameTypeConstraintsDescription
systemidINTEGERNOT NULLSystem-generated primary key
projectINTEGERNOT NULLThe project this thread is against
ownerINTEGERNOT NULLForeign key to the user who started this thread
threadtitleVARCHAR (100)NOT NULLTitle of the thread
Primary key
NameColumnsDescription
pk_projectthreadsystemid
Foreign keys
NameColumnsReferenced tableDescription
fk_projectthread_projectprojectproject
fk_projectthread_systemuserownersystemuser
Incoming foreign keys
NameColumnsReferencing tableDescription
fk_projectcomment_projectthreadprojectthreadprojectcomment
Indexes
NameColumnsDescription
in_projectthread_projectproject
in_projectthread_ownerowner

Table: projectcomment
Review comments made against a project thread
Columns
NameTypeConstraintsDescription
systemidINTEGERNOT NULLSystem-generated primary key
projectthreadINTEGERNOT NULLThe project thread this comment is against
ownerINTEGERNOT NULLForeign key to the user who made this comment
createdateTIMESTAMPNOT NULLCreation time of the comment
commentTEXTNOT NULLThe comment itself
reviewdateTIMESTAMPTime when the review comment was added (at the review meeting)
reviewcommentTEXTReview comment (from the review meeting)
reviewerINTEGERForeign key to the comment reviewer
reviewdecisionVARCHAR (50)Action required on this comment, as decided in the review meeting. Values are:
NA: No action required
CI: Comment incorrect
UF: Urgent fix required
FR: Fix before release
ER: Raise ER
DR: Raise DR
reviewactionownerINTEGERForeign key to the user tasked with actioning the review decision
actiondateTIMESTAMPTime when any necessary action arising from the review meeting was updated
actioncommentTEXTComment made by the actioner about the actions taken (if any)
actionerINTEGERForeign key to the user who completed the required actions
actionscompleteCHAR (1)Y if actioner has signed off on all required action
Primary key
NameColumnsDescription
pk_projectcommentsystemid
Foreign keys
NameColumnsReferenced tableDescription
fk_projectcomment_projectthreadprojectthreadprojectthread
fk_projectcomment_systemuser_ownerownersystemuser
fk_projectcom_systemuser_reviewerreviewersystemuser
fk_projectcom_systemuser_revactionreviewactionownersystemuser
fk_projectcom_systemuser_actioneractionersystemuser
Indexes
NameColumnsDescription
in_projectcomment_projectthreadprojectthread
in_projectcomment_ownerowner
in_projectcomment_reviewerreviewer
in_projectcomment_revactionreviewactionowner
in_projectcomment_actioneractioner

Table: projectfile
Represents a file within a project that has been selected for review
Columns
NameTypeConstraintsDescription
systemidINTEGERNOT NULLSystem-generated primary key
projectINTEGERNOT NULLThe project this file belongs to
pathVARCHAR (500)NOT NULLRelative path to the file within the file set for the project
originalpathVARCHAR (500)Optional relative path to the original version of the file within the original file set for the project. Used when the file has been renamed or moved
changetypeCHAR (1)NOT NULLType of change made to this file between original and new versions. Values are:
C: Changed
A: Added
R: Removed
notesTEXTFree-form notes to assist reviewers
reviewprioritySMALLINTPriority of this file (1-3, 3 is highest) for reviewing
Primary key
NameColumnsDescription
pk_projectfilesystemid
Foreign keys
NameColumnsReferenced tableDescription
fk_projectfile_projectprojectproject
Incoming foreign keys
NameColumnsReferencing tableDescription
fk_filecomment_projectfileprojectfilefilecomment
Indexes
NameColumnsDescription
in_projectfile_project_pathproject, path NOTE:
This index should be used on all DB's but MySQL (which requires that a length be specified for the text column)

Table: filecomment
Review comments made against lines in a file
Columns
NameTypeConstraintsDescription
systemidINTEGERNOT NULLSystem-generated primary key
projectfileINTEGERNOT NULLThe project file this comment is against
linenumberINTEGERNOT NULLLine number in the file for this comment (1-based)
ownerINTEGERNOT NULLForeign key to the user who made this comment
createdateTIMESTAMPNOT NULLCreation time of the comment
commentTEXTNOT NULLThe comment itself
reviewdateTIMESTAMPTime when the review comment was added (at the review meeting)
reviewcommentTEXTReview comment (from the review meeting)
reviewerINTEGERForeign key to the comment reviewer
reviewdecisionVARCHAR (50)Action required on this comment, as decided in the review meeting. Values are:
NA: No action required
CI: Comment incorrect
UF: Urgent fix required
FR: Fix before release
ER: Raise ER
DR: Raise DR
reviewactionownerINTEGERForeign key to the user tasked with actioning the review decision
actiondateTIMESTAMPTime when any necessary action arising from the review meeting was updated
actioncommentTEXTComment made by the actioner about the actions taken (if any)
actionerINTEGERForeign key to the user who completed the required actions
actionscompleteCHAR (1)Y if actioner has signed off on all required action
Primary key
NameColumnsDescription
pk_filecommentsystemid
Foreign keys
NameColumnsReferenced tableDescription
fk_filecomment_projectfileprojectfileprojectfile
fk_filecomment_systemuser_ownerownersystemuser
fk_filecom_systemuser_reviewerreviewersystemuser
fk_filecom_systemuser_revactionreviewactionownersystemuser
fk_filecom_systemuser_actioneractionersystemuser
Indexes
NameColumnsDescription
in_filecomment_ownerowner
in_filecomment_reviewerreviewer
in_filecomment_revactionreviewactionowner
in_filecomment_actioneractioner

Sequence: tableids
Sequence used to generate system IDs (primary keys) for all tables
Starts from: 1