Ravenbrook / Projects / Perforce Defect Tracking Integration / Version 2.1 Product Sources / Design

Perforce Defect Tracking Integration Project


Bugzilla database schema

Nick Barnes, Ravenbrook Limited, 2000-11-14

1. Introduction

This document describes the Bugzilla database schema for Bugzilla versions 2.10, 2.12, 2.14, 2.14.1, 2.14.2, 2.14.3, 2.14.4, 2.14.5, 2.16rc1, 2.16rc2, 2.16, 2.16.1, 2.16.2, 2.16.3, 2.16.4, 2.17.1, 2.17.3, 2.17.4, 2.17.5, and 2.17.6.

This document is now generated automatically by a Python script which constructs and colours the schema tables from the results of MySQL queries.

The purpose of this document is to act as a reference while developing P4DTI code which interacts with Bugzilla.

The intended readership is P4DTI developers.

This document is not confidential.

2. Bugzilla overview

Bugzilla is a defect tracking system, written in Perl with a CGI web GUI. It uses MySQL to store its tables. We need to understand Bugzilla and MySQL to build a P4DTI Bugzilla integration.

Bugzilla Releases

This table gives the dates of all the Bugzilla releases since 2.0, and of each P4DTI release which changed the set of supported Bugzilla releases, and shows the history of P4DTI support for each release.

Date Release First P4DTI Release Last P4DTI Release Notes
1998-09-19 2.0 - - Never supported by the P4DTI. Not described in this document.
1999-02-10 2.2 - - Never supported by the P4DTI. Not described in this document.
1999-04-30 2.4 - - Never supported by the P4DTI. Not described in this document.
1999-08-30 2.6 - - Never supported by the P4DTI. Not described in this document.
1999-11-19 2.8 - - Never supported by the P4DTI. Not described in this document.
2000-05-09 2.10 1.0.0 1.5.3 The first Bugzilla release supported by the P4DTI.
2001-02-19 P4DTI release 1.0.0, supporting Bugzilla 2.10.
2001-04-27 2.12 1.1.2 1.5.3  
2001-07-16 P4DTI release 1.1.2, supporting Bugzilla 2.10 and 2.12.
2001-08-29 2.14 1.2.0 1.5.3  
2001-10-18 P4DTI release 1.2.0, supporting Bugzilla 2.10, 2.12, and 2.14.
2002-01-05 2.14.1 1.4.0 1.5.3 A security patch release.
2002-02-04 P4DTI release 1.4.0, supporting Bugzilla 2.10, 2.12, 2.14, and 2.14.1.
2002-05-10 2.16rc1 - - A release candidate. Never supported by the P4DTI. Schema is as for 2.16.
2002-06-07 2.16rc2 - - A release candidate. Never supported by the P4DTI. Schema is as for 2.16.
2002-06-07 2.14.2 - - A security patch release. Never formally supported by the P4DTI. Use 2.14.5 or 2.16.3 instead.
2002-07-28 2.16 - - Never formally supported by the P4DTI. Use 2.16.3 instead.
2002-07-28 2.14.3 - - A security patch release. Never formally supported by the P4DTI. Use 2.14.5 or 2.16.3 instead.
2002-09-30 2.16.1 1.5.0 - A security patch release. Deprecated in P4DTI 2.0 (use 2.16.3 instead).
2002-09-30 2.14.4 1.5.0 - A security patch release. The first Bugzilla-on-Windows release supported by the P4DTI. Deprecated in P4DTI 2.0 (use 2.14.5 or 2.16.3 instead).
2002-11-01 P4DTI release 1.5.0, supporting Bugzilla 2.14.4 and 2.16.1. Bugzilla 2.14.4 supported on Windows. Bugzilla 2.10, 2.12, 2.14, 2.14.1 deprecated. Patches also supplied for Bugzilla 2.14.2, 2.14.3, and 2.16.
2002-11-25 2.17.1 - - A development release. Never supported by the P4DTI.
2003-01-02 2.16.2 2.0.0 - A security patch release. Deprecated in P4DTI 2.0 (use 2.16.3 instead).
2003-01-02 2.14.5 2.0.0 - A security patch release. Currently supported by the P4DTI on Windows, Linux, and Unix.
2003-01-02 2.17.3 - - A development release. Never supported by the P4DTI. There was no release 2.17.2.
2003-04-25 2.16.3 2.0.0 - Currently supported by the P4DTI on Linux and Unix only.
2003-04-25 2.17.4 - - A development release. Never supported by the P4DTI.
2003-06-02 P4DTI release 2.0.0, supporting Bugzilla 2.14.5 and 2.16.3. Bugzilla 2.14.5 supported on Windows. Bugzilla 2.14.4, 2.16.1, and 2.16.2 deprecated.
2003-11-03 2.17.5 - - A development release. Never supported by the P4DTI.
2003-11-03 2.16.4 - - Not yet supported by the P4DTI.
2003-11-10 2.17.6 - - A development release. Never supported by the P4DTI.

The P4DTI currently supports Bugzilla 2.14.4, 2.14.5, 2.16.1, 2.16.2, 2.16.3, and 2.16.4. During the lifetime of this document it has also had some form of support for Bugzilla 2.10, 2.12, 2.14, 2.14.1, 2.14.2, 2.14.3, and 2.16. It is intended to support 2.18 when it arrives as the culmination of the 2.17.x series of releases.

Bugzilla Schema Changes

Where the Bugzilla schema has been changed since Bugzilla 2.10, the change is noted in this document. We need to be able to recognize the schema version.

In the schema tables themselves, changed fields are noted and colored as follows:

A field whose definition and use which has not changed between 2.10 and 2.17.6.
A field which was present in some previous Bugzilla release but which is absent from 2.17.6.
A field which is present in 2.17.6 but was absent in some previous Bugzilla release.
A field whose definition has changed over time.

In Bugzilla release 2.12, the following schema changes were made:

In Bugzilla release 2.14, the following schema changes were made:

The schema is identical in Bugzilla releases 2.14 and 2.14.1.

In Bugzilla release 2.14.2, the following schema change was made:

The schema is identical in Bugzilla releases 2.14.2, 2.14.3, 2.14.4, and 2.14.5.

In Bugzilla release 2.16 (and the release candidates 2.16rc1 and 2.16rc2), the following schema changes were made:

The schema is identical in Bugzilla releases 2.16rc1, 2.16rc2, 2.16, 2.16.1, 2.16.2, 2.16.3, and 2.16.4.

In Bugzilla release 2.17.1, the following schema changes were made:

## Note: I am still working on updating the schema remarks to reflect all these changes. Changes which have not yet been reflected in the remarks are marked here with "##".

## We also need more extensive notes on some aspects of Bugzilla which have been changed in this release, in particular the groups system. ##

The schema is identical in Bugzilla releases 2.17.1 and 2.17.2.

In Bugzilla release 2.17.3, the following schema changes were made:

## Note: I am still working on updating the schema remarks to reflect all these changes. Changes which have not yet been reflected in the schema remarks are marked here with "##".

In Bugzilla release 2.17.4, the following schema changes were made:

In Bugzilla release 2.17.5, the following schema changes were made:

## Note: I am still working on updating the schema remarks to reflect all these changes. Changes which have not yet been reflected in the schema remarks are marked here with "##".

The schema is identical in Bugzilla releases 2.17.5 and 2.17.6.

Bugs

Each defect is called a bug and corresponds to one row in the bugs table. It is identified by its number, bugs.bug_id.

Products and components

The work managed by Bugzilla is divided into products. Each product is represented by a row in the products table. The work for each product is in turn divided into the components of that product. Each component is represented by a row in the components table.

Several properties of a new bug (e.g. ownership) are determined by the product and component to which it belongs.

Workflow

Each bug has a status (bugs.bug_status). If a bug has a status which shows it has been resolved, it also has a resolution (bugs.resolution), otherwise the resolution field is empty. These tables show the possible values of these fields and the valid transitions of the status field.

Status Resolved? Description Transitions
UNCONFIRMED No A new bug, when a product has voting to NEW by voting or confirmation
to ASSIGNED by acceptance
to RESOLVED by resolution
NEW No Recently added or confirmed to ASSIGNED by acceptance
to RESOLVED by analysis and maybe fixing
to NEW by reassignment
ASSIGNED No Has been assigned to NEW by reassignment
to RESOLVED by analysis and maybe fixing
REOPENED No Was once resolved but has been reopened to NEW by reassignment
to ASSIGNED by acceptance
to RESOLVED by analysis and maybe fixing
RESOLVED Yes Has been resolved (e.g. fixed, deemed unfixable, etc. See "resolution" column) to REOPENED by reopening
to VERIFIED by verification
to CLOSED by closing
VERIFIED Yes The resolution has been approved by QA to CLOSED when the product ships
to REOPENED by reopening
CLOSED Yes Over and done with to REOPENED by reopening
Resolution Meaning
FIXED The bug has been fixed.
INVALID The problem described is not a bug.
WONTFIX This bug will never be fixed.
LATER This bug will not be fixed in this version.
REMIND This bug probably won't be fixed in this version.
DUPLICATE This is a duplicate of an existing bug. (a description comment is added to this effect, and from 2.12 a record is added to the duplicates table).
WORKSFORME This bug could not be reproduced.
MOVED This bug has been moved to another database. Added in 2.12.

Users

Bugzilla has users. Each user is represented by one row in the profiles table. Each user is referred by a number (profiles.userid) and an email address (profiles.login_name).

Authentication

Each user has a password, used to authenticate that user to Bugzilla. The password is stored in profiles.cryptpassword in encrypted form. Before 2.14, it was also stored in profiles.password as plaintext.

On a successful login, Bugzilla generates a pair of cookies for the user's browser. On subsequent accesses, a user gets access if these cookie checks pass (CGI.pl):

  1. they have both Bugzilla_login and Bugzilla_logincookie cookies;
  2. their Bugzilla_login is the login_name of a row in the profiles table;
  3. their Bugzilla_logincookie matches a row in the logincookies table
  4. the userids of these two rows match;
  5. (before 2.16) the cryptpasswords of these two rows match;
  6. (before 2.14.2) the hostname of the logincookies row matches the CGI REMOTE_HOST;
  7. (from 2.14.2) the IP address of the logincookies row matches the CGI REMOTE_ADDR.

and also their account is not disabled (i.e. profiles.disabledtext is empty).

If the cookie checks fail, the user has to login (with their password), in which case a new row is added to the logincookies table and the user gets a new pair of cookies.

Rows in the logincookies table are deleted after 30 days (at user login time; CGI.pl).

Voting

Users may vote for bugs which they think are important. The maximum number of votes per user is product-dependent. A user can vote for a bug more than once. Whether or not project managers pay any attention to votes is up to them, apart from the "confirmation by acclamation" process, which is as follows:

New bugs have the status UNCONFIRMED. To enter the main workflow, they need the status NEW. To get the status NEW, they need a particular number of votes which is product-dependent.

Votes are recorded in the votes table.

Milestones

Products may have "milestones" defined. The intention is that a milestone should be a point in a project at which a set of bugs has been resolved. An example might be a product release or a QA target. Milestones may be turned on and off with the parameter "usetargetmilestone".

If milestones are on, each bug has a "target milestone" (by which it should be fixed). A product may have a URL associated with it which locates a document describing the milestones for that product. This document itself is entirely outside Bugzilla. A product may also have a default target milestone, which is given to new bugs.

Milestones for a product have a "sort key", which allows them to be kept in an order. As far as I can tell, this order is only used for ordering user interface items (e.g. menu entries).

Milestones are kept in the milestones table.

Versions

Products may have versions. This allows more accurate bug reporting: "we saw it in 1.3.7b3". Versions are totally independent of milestones.

Parameters

The operation of Bugzilla is controlled by parameters. These are defined in defparams.pl, and set in editparams.cgi. The current values are stored in data/params. They are not stored in the database.

Groups

Bugzilla has "groups" of users. Membership of a group allows a user to perform certain tasks. Each group is represented by a row of the groups table.

There are a number of built-in groups, as follows:

Name Description
tweakparams Can tweak operating parameters
editusers Can edit or disable users
creategroups Can create and destroy groups
editcomponents Can create, destroy, and edit components
editkeywords Can create, destroy, and edit keywords
editbugs Can edit all aspects of any bug
canconfirm Can confirm a bug

Group membership is conferred by the bit being set in profiles.groupset. Group membership for new users is determined by matching groups.userregexp against the new user's email address. The default configuration has universal regexps for the "editbugs" and "canconfirm" groups.

New groups may be added (editgroups.cgi) and used to control access to sets of bugs. These "bug groups" have group.isbuggroup set to 1. Members of a bug group may see bugs in this group (using bugs.groupset).

If the parameter "usebuggroups" is on, each product automatically has a bug group associated with it.

If the parameter "usebuggroupsentry" is also on, the product's bug group also determines the set of users able to enter bugs for the product.

Attachments

Users can upload attachments to bugs. An attachments can be marked as a patch. Attachments are stored in the attachments table. From 2.16, attachments can be marked as "obsolete".

From 2.16, each attachment may have one of a number of "status" keywords associated with it. The status keywords are user-defined on a per-product basis. The set of status keywords is defined in the attachstatusdefs table. Whether a given attachment has a given status keyword is defined by the attachstatuses table.

Keywords

Bugzilla users can define a number of keywords, and then give each bug a set of keywords. This is mainly for use in finding related bugs. The keywords are stored in the keyworddefs table, and the one-to-many mapping from bugs to keywords is stored in the keywords table, and also in bugs.keywords.

Dependencies

Bugs may depend on other bugs being fixed. That is, it may be impossible to fix one bug until another one is fixed. Bugzilla records and displays such information and uses it to notify users when a bug changes (all contacts for all dependent bugs are notified when a bug changes).

Dependencies are recorded in the dependenciestable.

Activity

Bugzilla keeps a record of changes made to bugs. This record is in the bugs_activity table. Each row in this table records a change to a field in the bugs table. The fields are referred to by a number which is looked up in the fielddefs table. This table records the name of the field and also a longer description used to display activity tables.

Severity

Each bug has a "severity" field, bugs.bug_severity, indicating the severity of the impact of the bug. There is no code in Bugzilla which distinguishes the values of this field, although it may naturally be used in queries. The intended meanings of the values of this field are as follows:

Value Intended meaning
Blocker Blocks development and/or testing work
Critical Crashes, loss of data, severe memory leak
Major Major loss of function
Minor Minor loss of function, or other problem where easy workaround is present
Trivial Cosmetic problem
Enhancement Request for enhancement

Email notification

When a bug changes, email notification is sent out to a number of users:

This is handled by the "processmail" script.

Long descriptions

Each bug has a number of comments associated with it. These are stored in the longdescs table and displayed as the "Description" on the bug form, ordered by date and annotated with the user and date. Users can add new comments with the "Additional comment" field on the bug form.

Named queries

Users can name queries. Named queries appear in a pop-up on the query page. A query named "(Default query)" is a user's default query. Named queries are stored in the namedqueries table.

Watchers

Bugzilla lets users "watch" each other; receiving each other's Bugzilla email. For instance, if Sam goes on holiday, Phil can "watch" her, receiving all her Bugzilla email. This is set up by the user preferences (userprefs.cgi), recorded in the watch table and handled by the processmail script.

Shadow database

Note: Shadow databases were removed in Bugzilla 2.17.3. Administrators can use MySQL's replication facilities to provide a similar benefit.

Until Bugzilla 2.17.3, Bugzilla could maintain a shadow, read-only copy of everything in another database (with the parameter "shadowdb"). If the parameter "queryagainstshadowdb" is on, queries were run against the shadow. The shadowlog table kept a record of SQL activity since the last reflection.

List of tables

Name Description
attachments Bug attachments.
attachstatusdefs Attachment status definitions Added in 2.16, removed in 2.17.1.
attachstatuses Attachment statuses Added in 2.16, removed in 2.17.1..
bug_group_map Added in 2.17.1.
bugs The bugs themselves.
bugs_activity Activity on the bugs table.
cc Users who have asked to receive email when a bug changes.
components Components of products
dependencies Which bugs depend on other bugs
duplicates Which bugs are duplicates of which other bugs. Added in 2.12.
fielddefs Descriptions of fields in the bugs table. Used for reporting activity.
flagexclusions Added in 2.17.1.
flaginclusions Added in 2.17.1.
flags Added in 2.17.1.
flagtypes Added in 2.17.1.
group_control_map Added in 2.17.3.
group_group_map Added in 2.17.1.
groups User groups
keyworddefs Descriptions of keywords.
keywords Which bugs have which keywords.
logincookies Record of cookies used for authentication
longdescs Long bug descriptions
milestones Milestones
namedqueries Named queries
products Products
profiles The table of Bugzilla users.
profiles_activity A record of activity in the profiles table.
quips Added in 2.17.1.
series Added in 2.17.5.
series_categories Added in 2.17.5.
series_data Added in 2.17.5.
shadowlog A log of SQL activity; used for updating shadow databases. Removed in 2.17.3.
tokens Email tokens. Added in 2.14.
user_group_map Added in 2.17.1.
user_series_map Added in 2.17.5.
versions Product versions.
votes votes
watch watchers

3. The schema

Note: this schema description is now automatically generated.

The "attachments" table

Field Type Default Properties Remarks
attach_id mediumint None auto_increment a unique ID.
bug_id mediumint 0 - the bug to which this is attached (foreign key bugs.bug_id)
creation_ts 2.10: timestamp(14);
2.17.1: datetime
2.10: None;
2.17.1: 0000-00-00 00:00:00
2.10: null;
2.17.1: -
the creation time.
description mediumtext '' - a description of the attachment.
filename 2.10: mediumtext;
2.17.1: varchar(100)
'' - the filename of the attachment.
isobsolete tinyint 0 - Non-zero if this attachment is marked as obsolete. Added in 2.16.
ispatch tinyint None null non-zero if this attachment is a patch file.
isprivate tinyint 0 - Non-zero if this attachment is "private", i.e. only visible to members of the "insider" group. Added in 2.17.1.
mimetype mediumtext '' - the MIME type of the attachment.
submitter_id mediumint 0 - the userid of the attachment (foreign key profiles.userid)
thedata longblob '' - the content of the attachment.

Indexes:

Name Fields Unique? Remarks
PRIMARY attach_id yes -
bug_id bug_id no -
creation_ts creation_ts no -

The "attachstatusdefs" table

Added in 2.16. Removed in 2.17.1 (replaced by the flag tables).

Field Type Default Properties Remarks
description mediumtext None null The description of the attachment status.
id smallint 0 - a unique ID.
name varchar(50) '' - the name of the attachment status.
product varchar(64) '' - The product for which bugs can have attachments with this status (foreign key products.product)
sortkey smallint 0 - A number used to determine the order in which attachment statuses are shown.

Indexes:

Name Fields Unique? Remarks
PRIMARY id yes -

The "attachstatuses" table

Added in 2.16. Removed in 2.17.1 ( replaced by the flag tables).

Field Type Default Properties Remarks
attach_id mediumint 0 - The id of the attachment (foreign key attachments.attach_id)
statusid smallint 0 - The id of the status (foreign key attachstatusdefs.id)

Indexes:

Name Fields Unique? Remarks
PRIMARY attach_id, statusid yes -

The "bug_group_map" table

Added in 2.17.1.

Field Type Default Properties Remarks
bug_id mediumint 0 - -
group_id mediumint 0 - -

Indexes:

Name Fields Unique? Remarks
bug_id bug_id, group_id yes -
group_id group_id no -

The "bugs" table

Field Type Default Properties Remarks
alias varchar(20) None null Added in 2.17.1.
assigned_to mediumint 0 - The current owner of the bug.
assignee_accessible tinyint 1 - 1 if the assignee can see this bug (even if in the wrong group); 0 otherwise. Added in 2.14. Removed in 2.16.
bug_file_loc text None null A URL which points to more information about the bug.
bug_id mediumint None auto_increment The bug ID.
bug_severity enum('blocker', 'critical', 'major', 'normal', 'minor', 'trivial', 'enhancement') blocker - See the notes.
bug_status enum('UNCONFIRMED', 'NEW', 'ASSIGNED', 'REOPENED', 'RESOLVED', 'VERIFIED', 'CLOSED') UNCONFIRMED - The workflow status of the bug.
cclist_accessible tinyint 1 - 1 if people on the CC list can see this bug (even if in the wrong group); 0 otherwise. Added in 2.14.
component varchar(50) '' - The product component (foreign key components.value) Removed in 2.17.1 (replaced by "component_id").
component_id smallint 0 - The product component (foreign key components.id) Added in 2.17.1 (replacing "component").
creation_ts datetime 0000-00-00 00:00:00 - The times of the bug's creation.
delta_ts timestamp(14) None null The timestamp of the last update. This includes updates to some related tables (e.g. the "longdescs" table).
estimated_time decimal(5,2) 0.00 - Added in 2.17.1.
everconfirmed tinyint 0 - 1 if this bug has ever been confirmed. This is used for validation of some sort.
groupset bigint 0 - The groups which this bug occupies. Each group corresponds to one bit. See the "groups" table. Removed in 2.17.1.
keywords mediumtext '' - A set of keywords. Note that this duplicates the information in the "keywords" table. (foreign key keyworddefs.name)
lastdiffed datetime 0000-00-00 00:00:00 - The time at which information about this bug changing was last emailed to the cc list.
op_sys 2.10: enum('All', 'Windows 3.1', 'Windows 95', 'Windows 98', 'Windows 2000', 'Windows NT', 'Mac System 7', 'Mac System 7.5', 'Mac System 7.6.1', 'Mac System 8.0', 'Mac System 8.5', 'Mac System 8.6', 'Mac System 9.0', 'AIX', 'BSDI', 'HP-UX', 'IRIX', 'Linux', 'FreeBSD', 'OSF/1', 'Solaris', 'SunOS', 'Neutrino', 'OS/2', 'BeOS', 'OpenVMS', 'other');
2.12: enum('All', 'Windows 3.1', 'Windows 95', 'Windows 98', 'Windows ME', 'Windows 2000', 'Windows NT', 'Mac System 7', 'Mac System 7.5', 'Mac System 7.6.1', 'Mac System 8.0', 'Mac System 8.5', 'Mac System 8.6', 'Mac System 9.0', 'Linux', 'BSDI', 'FreeBSD', 'NetBSD', 'OpenBSD', 'AIX', 'BeOS', 'HP-UX', 'IRIX', 'Neutrino', 'OpenVMS', 'OS/2', 'OSF/1', 'Solaris', 'SunOS', 'other');
2.16: enum('All', 'Windows 3.1', 'Windows 95', 'Windows 98', 'Windows ME', 'Windows 2000', 'Windows NT', 'Windows XP', 'Mac System 7', 'Mac System 7.5', 'Mac System 7.6.1', 'Mac System 8.0', 'Mac System 8.5', 'Mac System 8.6', 'Mac System 9.x', 'MacOS X', 'Linux', 'BSDI', 'FreeBSD', 'NetBSD', 'OpenBSD', 'AIX', 'BeOS', 'HP-UX', 'IRIX', 'Neutrino', 'OpenVMS', 'OS/2', 'OSF/1', 'Solaris', 'SunOS', 'other');
2.17.1: enum('All', 'Windows 3.1', 'Windows 95', 'Windows 98', 'Windows ME', 'Windows 2000', 'Windows NT', 'Windows XP', 'Mac System 7', 'Mac System 7.5', 'Mac System 7.6.1', 'Mac System 8.0', 'Mac System 8.5', 'Mac System 8.6', 'Mac System 9.x', 'Mac OS X 10.0', 'Mac OS X 10.1', 'Mac OS X 10.2', 'Linux', 'BSDI', 'FreeBSD', 'NetBSD', 'OpenBSD', 'AIX', 'BeOS', 'HP-UX', 'IRIX', 'Neutrino', 'OpenVMS', 'OS/2', 'OSF/1', 'Solaris', 'SunOS', 'other');
2.17.5: enum('All', 'Windows 3.1', 'Windows 95', 'Windows 98', 'Windows ME', 'Windows 2000', 'Windows NT', 'Windows XP', 'Windows Server 2003', 'Mac System 7', 'Mac System 7.5', 'Mac System 7.6.1', 'Mac System 8.0', 'Mac System 8.5', 'Mac System 8.6', 'Mac System 9.x', 'Mac OS X 10.0', 'Mac OS X 10.1', 'Mac OS X 10.2', 'Linux', 'BSD/OS', 'FreeBSD', 'NetBSD', 'OpenBSD', 'AIX', 'BeOS', 'HP-UX', 'IRIX', 'Neutrino', 'OpenVMS', 'OS/2', 'OSF/1', 'Solaris', 'SunOS', 'other')
All - The operating system on which the bug was observed.
priority enum('P1', 'P2', 'P3', 'P4', 'P5') P1 - The priority of the bug (P1 = most urgent, P5 = least urgent).
product varchar(64) '' - The product (foreign key products.product) Removed in 2.17.1 (replaced by "product_id").
product_id smallint 0 - The product (foreign key products.id) Added in 2.17.1 (replacing "product").
qa_contact mediumint 0 - The QA contact (foreign key profiles.userid)
qacontact_accessible tinyint 1 - 1 if the QA contact can see this bug (even if in the wrong group); 0 otherwise. Added in 2.14. Removed in 2.16.
remaining_time decimal(5,2) 0.00 - Added in 2.17.1.
rep_platform enum('All', 'DEC', 'HP', 'Macintosh', 'PC', 'SGI', 'Sun', 'Other') None null The platform on which the bug was reported.
reporter mediumint 0 - The user who reported this (foreign key profiles.userid)
reporter_accessible tinyint 1 - 1 if the reporter can see this bug (even if in the wrong group); 0 otherwise. Added in 2.14.
resolution 2.10: enum('', 'FIXED', 'INVALID', 'WONTFIX', 'LATER', 'REMIND', 'DUPLICATE', 'WORKSFORME');
2.12: enum('', 'FIXED', 'INVALID', 'WONTFIX', 'LATER', 'REMIND', 'DUPLICATE', 'WORKSFORME', 'MOVED')
'' - The bug's resolution
short_desc mediumtext None null A short description of the bug.
status_whiteboard mediumtext '' - This seems to be just a small whiteboard field.
target_milestone varchar(20) --- - The milestone by which this bug should be resolved. (foreign key milestones.value)
version 2.10: varchar(16);
2.14: varchar(64)
'' - The product version (foreign key versions.value)
votes mediumint 0 - The number of votes.

Indexes:

Name Fields Unique? Remarks
PRIMARY bug_id yes -
alias alias yes Added in 2.17.1.
assigned_to assigned_to no -
bug_severity bug_severity no -
bug_status bug_status no -
component component no Removed in 2.17.1 (replaced by "component_id").
component_id component_id no Added in 2.17.1 (replacing "component").
creation_ts creation_ts no -
delta_ts delta_ts no -
op_sys op_sys no -
priority priority no -
product product no Removed in 2.17.1 (replaced by "product_id").
product_id product_id no Added in 2.17.1 (replacing "product").
qa_contact qa_contact no -
reporter reporter no -
resolution resolution no -
short_desc short_desc no Added in 2.17.5.
target_milestone target_milestone no -
version version no -
votes votes no -

The "bugs_activity" table

Field Type Default Properties Remarks
added tinytext None null The new value of this field, or values which have been added for multi-value fields such as bugs.keywords, the "cc" table, and the "dependencies" table Added in 2.14 (replacing "newvalue").
attach_id mediumint None null If the change was to an attachment, the ID of the attachment (foreign key attachments.attach_id) Added in 2.16.
bug_id mediumint 0 - Which bug (foreign key bugs.bug_id)
bug_when datetime 0000-00-00 00:00:00 - When was the change made?
fieldid mediumint 0 - What was the fieldid? (foreign key fielddefs.fieldid)
newvalue tinytext None null The head of the new value. Removed in 2.14 (replaced by "added").
oldvalue tinytext None null The head of the old value. Removed in 2.14 (replaced by "removed").
removed tinytext None null The old value of this field, or values which have been removed for multi-value fields such as bugs.keywords, the "cc" table, and the "dependencies" table Added in 2.14 (replacing "oldvalue").
who mediumint 0 - Which user (foreign key profiles.userid)

Indexes:

Name Fields Unique? Remarks
bug_id bug_id no -
bug_when bug_when no -
fieldid fieldid no -

The "cc" table

Field Type Default Properties Remarks
bug_id mediumint 0 - The bug (foreign key bugs.bug_id)
who mediumint 0 - The user (foreign key profiles.userid)

Indexes:

Name Fields Unique? Remarks
bug_id bug_id, who yes -
who who no -

The "components" table

One row for each component. See the notes on products and components.

Field Type Default Properties Remarks
description mediumtext '' - A description of the component.
id smallint None auto_increment The component id. Added in 2.17.1 (replacing "value" as the primary key).
initialowner 2.10: tinytext;
2.12: mediumint
2.10: '';
2.12: 0
- The default initial owner of bugs in this component. On component creation, this is set to the user who creates the component. Before 2.12: foreign key profiles.login_name; from 2.12: foreign key profiles.userid.
initialqacontact 2.10: tinytext;
2.12: mediumint
2.10: '';
2.12: 0
- The initial "qa_contact" field for bugs of this component. Note that the use of the qa_contact field is optional, parameterized by Param("useqacontact"). Before 2.12: foreign key profiles.login_name; from 2.12: foreign key profiles.userid.
name varchar(64) '' - The component id. Added in 2.17.1 (replacing "value").
product_id smallint 0 - The product (foreign key products.id) Added in 2.17.1 (replacing "program").
program varchar(64) None null The product (foreign key products.product) Removed in 2.17.1 (replaced by "product_id").
value tinytext None null The component name. Removed in 2.17.1 (replaced by "name" and "id").

Indexes:

Name Fields Unique? Remarks
PRIMARY id yes Added in 2.17.1.
name name no Added in 2.17.1.
product_id product_id, name yes Added in 2.17.1.

The "dependencies" table

Field Type Default Properties Remarks
blocked mediumint 0 - Which bug is blocked (foreign key bugs.bug_id)
dependson mediumint 0 - Which bug does it depend on (foreign key bugs.bug_id)

Indexes:

Name Fields Unique? Remarks
blocked blocked no -
dependson dependson no -

The "duplicates" table

This table identifies bugs which are duplicates of other bugs.Added in 2.12.

Field Type Default Properties Remarks
dupe mediumint 0 - The duplicate bug (foreign key bugs.bug_id)
dupe_of mediumint 0 - The bug which is duplicated (foreign key bugs.bug_id)

Indexes:

Name Fields Unique? Remarks
PRIMARY dupe yes -

The "fielddefs" table

This is a table of the fields for which we update the "bugs_activity" table. It's used to turn bugs_activity entries into useful text.

Field Type Default Properties Remarks
description mediumtext '' - long description
fieldid mediumint None auto_increment primary key for this table
mailhead tinyint 0 - whether or not to send the field description in mail notifications.
name varchar(64) '' - field name or definition (some fields are names of other tables or of fields in other tables).
sortkey smallint 0 - the order of fields in mail notifications.

Indexes:

Name Fields Unique? Remarks
PRIMARY fieldid yes -
name name yes -
sortkey sortkey no -

The "flagexclusions" table

Added in 2.17.1.

Field Type Default Properties Remarks
component_id smallint None null -
product_id smallint None null -
type_id smallint 0 - -

Indexes:

Name Fields Unique? Remarks
type_id type_id, product_id, component_id no -

The "flaginclusions" table

Added in 2.17.1.

Field Type Default Properties Remarks
component_id smallint None null -
product_id smallint None null -
type_id smallint 0 - -

Indexes:

Name Fields Unique? Remarks
type_id type_id, product_id, component_id no -

The "flags" table

Added in 2.17.1.

Field Type Default Properties Remarks
attach_id mediumint None null -
bug_id mediumint 0 - -
creation_date datetime 0000-00-00 00:00:00 - -
id mediumint 0 - -
modification_date datetime None null -
requestee_id mediumint None null -
setter_id mediumint None null -
status char(1) '' - -
type_id smallint 0 - -

Indexes:

Name Fields Unique? Remarks
PRIMARY id yes -
bug_id bug_id, attach_id no -
requestee_id requestee_id no -
setter_id setter_id no -

The "flagtypes" table

Added in 2.17.1.

Field Type Default Properties Remarks
cc_list varchar(200) None null -
description text None null -
id smallint 0 - -
is_active tinyint 1 - -
is_multiplicable tinyint 0 - -
is_requestable tinyint 0 - -
is_requesteeble tinyint 0 - -
name varchar(50) '' - -
sortkey smallint 0 - -
target_type char(1) b - -

Indexes:

Name Fields Unique? Remarks
PRIMARY id yes -

The "group_control_map" table

Added in 2.17.3.

Field Type Default Properties Remarks
canedit tinyint 0 - -
entry tinyint 0 - -
group_id mediumint 0 - -
membercontrol tinyint 0 - -
othercontrol tinyint 0 - -
product_id mediumint 0 - -

Indexes:

Name Fields Unique? Remarks
group_id group_id no -
product_id product_id, group_id yes -

The "group_group_map" table

Added in 2.17.1.

Field Type Default Properties Remarks
grantor_id mediumint 0 - -
isbless tinyint 0 - -
member_id mediumint 0 - -

Indexes:

Name Fields Unique? Remarks
member_id member_id, grantor_id, isbless yes -

The "groups" table

This table describes a number of user groups. Each group allows its members to perform a restricted activity. See the notes on groups.

Field Type Default Properties Remarks
bit bigint 0 - 2^n for some n. Assigned automatically. Removed in 2.17.1 (replaced by "id").
description text '' - A long description of the group.
id mediumint None auto_increment Added in 2.17.1.
isactive tinyint 1 - 1 if bugs can be added to this group; 0 otherwise. Added in 2.14.
isbuggroup tinyint 0 - 1 if this is a group controlling access to a set of bugs.
last_changed datetime 0000-00-00 00:00:00 - Added in 2.17.1.
name varchar(255) '' - A short name for the group.
userregexp tinytext '' - a regexp used to determine membership of new users.

Indexes:

Name Fields Unique? Remarks
PRIMARY id yes Added in 2.17.1 (replacing "bit").
bit bit yes Removed in 2.17.1 (replaced by "PRIMARY").
name name yes -

The "keyworddefs" table

Names and definitions of the keywords. See the notes on keywords.

Field Type Default Properties Remarks
description mediumtext None null The meaning of the keyword.
id smallint 0 - A unique number identifying this keyword.
name varchar(64) '' - The keyword itself.

Indexes:

Name Fields Unique? Remarks
PRIMARY id yes -
name name yes -

The "keywords" table

Bugs may have keywords. This table defines which bugs have which keywords. The keywords are defined in the "keyworddefs" table.

Field Type Default Properties Remarks
bug_id mediumint 0 - The bug (foreign key bugs.bug_id)
keywordid smallint 0 - The keyword ID (foreign key keyworddefs.id)

Indexes:

Name Fields Unique? Remarks
bug_id bug_id, keywordid yes -
keywordid keywordid no -

The "logincookies" table

Bugzilla generates a cookie each time a user logs in, and uses it for subsequent authentication. The cookies generated are stored in this table. For more information, see the notes on authentication.

Field Type Default Properties Remarks
cookie mediumint None auto_increment The cookie
cryptpassword 2.10: varchar(64);
2.14: varchar(34)
None null The encrypted password used on this login. Removed in 2.16.
hostname varchar(128) None null The CGI REMOTE_HOST for this login. Removed in 2.14.2 (replaced by "ipaddr").
ipaddr varchar(40) '' - The CGI REMOTE_ADDR for this login. Added in 2.14.2 (replacing hostname).
lastused timestamp(14) None null The timestamp of this login.
userid mediumint 0 - The user id; (foreign key profiles.userid)

Indexes:

Name Fields Unique? Remarks
PRIMARY cookie yes -
lastused lastused no -

The "longdescs" table

Field Type Default Properties Remarks
bug_id mediumint 0 - the bug (foreign key bugs.bug_id)
bug_when datetime 0000-00-00 00:00:00 - when the text was added
isprivate tinyint 0 - Non-zero if this comment is "private", i.e. only visible to members of the "insider" group. Added in 2.17.1.
thetext mediumtext None null the text itself.
who mediumint 0 - the user who added this text (foreign key profiles.userid)
work_time decimal(5,2) 0.00 - Added in 2.17.1.

Indexes:

Name Fields Unique? Remarks
bug_id bug_id no -
bug_when bug_when no -
thetext thetext no Added in 2.17.5.
who who no Added in 2.14.

The "milestones" table

Field Type Default Properties Remarks
product varchar(64) '' - The product (foreign key products.product) Removed in 2.17.1 (replaced by "product_id").
product_id smallint 0 - The product (foreign key products.id) Added in 2.17.1 (replacing "product").
sortkey smallint 0 - A number used for sorting milestones for a given product.
value varchar(20) '' - The name of the milestone (e.g. "3.1 RTM", "0.1.37", "tweakfor BigCustomer", etc).

Indexes:

Name Fields Unique? Remarks
product product, value yes Removed in 2.17.1 (replaced by "product_id").
product_id product_id, value yes Added in 2.17.1 (replacing "product").

The "namedqueries" table

Field Type Default Properties Remarks
linkinfooter tinyint 0 - Whether or not the query should appear in the foot of every page.
name varchar(64) '' - The name of the query.
query mediumtext '' - The query (text to append to the query page URL).
userid mediumint 0 - The user whose query this is.
watchfordiffs tinyint 0 - Unused. Removed in 2.17.1.

Indexes:

Name Fields Unique? Remarks
userid userid, name yes -
watchfordiffs watchfordiffs no Removed in 2.17.1.

The "products" table

One row for each product. See the notes on products.

Field Type Default Properties Remarks
defaultmilestone varchar(20) --- - The default milestone for a new bug.
description mediumtext None null The description of the product
disallownew tinyint 0 - New bugs can only be created for this product if this is 0.
id smallint None auto_increment The product ID. Added in 2.17.1 (replacing "product" as the table key).
maxvotesperbug smallint 10000 - Maximum number of votes which a bug may have.
milestoneurl tinytext '' - The URL of a document describing the product milestones.
name varchar(64) '' - The product name. Added in 2.17.1 (replacing "product" as the product name).
product varchar(64) None null The name of the product. Removed in 2.17.1 (replaced with "id" and "name").
votesperuser smallint 0 - Total votes which a single user has for bugs of this product.
votestoconfirm smallint 0 - How many votes are required for this bug to become NEW.

Indexes:

Name Fields Unique? Remarks
PRIMARY id yes Added in 2.17.1.
name name yes Added in 2.17.1.

The "profiles" table

This table describes Bugzilla users. One row per user.

Field Type Default Properties Remarks
blessgroupset bigint 0 - Indicates the groups into which this user is able to introduce other users. Removed in 2.17.1.
cryptpassword 2.10: varchar(64);
2.14: varchar(34)
None null The user's password. Before 2.14, the MySQL function encrypt was used to encrypt passwords. From 2.14, the Perl function crypt is used instead.
disabledtext mediumtext 2.10: '';
2.12: None;
2.14: ''
2.10: -;
2.12: null;
2.14: -
If non-empty, indicates that this account has been disabled and gives a reason.
emailflags mediumtext None null Flags controlling when email messages are sent to this user. Added in 2.12.
emailnotification enum('ExcludeSelfChanges', 'CConly', 'All') ExcludeSelfChanges - Controls when email reporting bug changes is sent to this user. Removed in 2.14 (replaced in part by "emailflags").
groupset bigint 0 - The set of groups to which the user belongs. Each group corresponds to one bit and confers powers upon the user. See the "groups" table. Removed in 2.17.1.
login_name varchar(255) '' - The user's email address. Used when logging in or providing mailto: links.
mybugslink tinyint 1 - indicates whether a "My Bugs" link should appear at the bottom of each page.
newemailtech tinyint 2.10: 0;
2.12: 1
- is non-zero if the user wants to user the "new" email notification technique. Removed in 2.14.
password varchar(16) None null The user's password, in plaintext. Removed in 2.14.
realname varchar(255) None null The user's real name.
refreshed_when datetime 0000-00-00 00:00:00 - Added in 2.17.1.
userid mediumint None auto_increment A unique identifier for the user. Used in other tables to identify this user.

Indexes:

Name Fields Unique? Remarks
PRIMARY userid yes -
login_name login_name yes -

The "profiles_activity" table

This table is for recording changes to the "profiles" table. Currently it only records changes to profiles.groupset made with editusers.cgi. This allows the administrator to track group inflation. There is currently no code to inspect this table; only to add to it.

Field Type Default Properties Remarks
fieldid mediumint 0 - The ID of the changed field (foreign key fielddefs.fieldid)
newvalue tinytext None null The new value.
oldvalue tinytext None null The old value
profiles_when datetime 0000-00-00 00:00:00 - When it was changed
userid mediumint 0 - The profile which has changed (foreign key profiles.userid)
who mediumint 0 - The user who changed it (foreign key profiles.userid)

Indexes:

Name Fields Unique? Remarks
fieldid fieldid no -
profiles_when profiles_when no -
userid userid no -

The "quips" table

Added in 2.17.1.

Field Type Default Properties Remarks
approved tinyint(1) 1 - Added in 2.17.4.
quip text '' - -
quipid mediumint None auto_increment -
userid mediumint 0 - -

Indexes:

Name Fields Unique? Remarks
PRIMARY quipid yes -

The "series" table

Added in 2.17.5.

Field Type Default Properties Remarks
category smallint 0 - -
creator mediumint 0 - -
frequency smallint 0 - -
last_viewed datetime None null -
name varchar(64) '' - -
query mediumtext '' - -
series_id mediumint None auto_increment -
subcategory smallint 0 - -

Indexes:

Name Fields Unique? Remarks
PRIMARY series_id yes -
creator creator, category, subcategory, name yes -
creator_2 creator no -

The "series_categories" table

Added in 2.17.5.

Field Type Default Properties Remarks
category_id smallint None auto_increment -
name varchar(64) '' - -

Indexes:

Name Fields Unique? Remarks
PRIMARY category_id yes -
name name yes -

The "series_data" table

Added in 2.17.5.

Field Type Default Properties Remarks
date datetime 0000-00-00 00:00:00 - -
series_id mediumint 0 - -
value mediumint 0 - -

Indexes:

Name Fields Unique? Remarks
series_id series_id, date yes -

The "shadowlog" table

Removed in 2.17.3 (similar functionality now available using MySQL's replication facilities).

Field Type Default Properties Remarks
command mediumtext '' - SQL command
id int None auto_increment unique id
reflected tinyint 0 - 0
ts timestamp(14) None null timestamp

Indexes:

Name Fields Unique? Remarks
PRIMARY id yes -
reflected reflected no -

The "tokens" table

Used for managing the tokens sent to users who wish to change their password (or email address, from 2.16).Added in 2.14.

Field Type Default Properties Remarks
eventdata tinytext None null -
issuedate datetime 0000-00-00 00:00:00 - The date at which the token was issued
token varchar(16) '' - The token itself.
tokentype varchar(8) '' - The type of the token. Before 2.16: only "password".From 2.16: also "emailold" and "emailnew".
userid mediumint 0 - The user to whom the token was issued. (foreign key profiles.userid)

Indexes:

Name Fields Unique? Remarks
PRIMARY token yes -
userid userid no -

The "user_group_map" table

Added in 2.17.1.

Field Type Default Properties Remarks
group_id mediumint 0 - -
isbless tinyint 0 - -
isderived tinyint 0 - -
user_id mediumint 0 - -

Indexes:

Name Fields Unique? Remarks
user_id user_id, group_id, isderived, isbless yes -

The "user_series_map" table

Added in 2.17.5.

Field Type Default Properties Remarks
series_id mediumint 0 - -
user_id mediumint 0 - -

Indexes:

Name Fields Unique? Remarks
series_id series_id no -
user_id user_id, series_id yes -

The "versions" table

Field Type Default Properties Remarks
product_id smallint 0 - The product (foreign key products.id) Added in 2.17.1 (replacing "program").
program varchar(64) '' - The product (foreign key products.product) Removed in 2.17.1 (replaced by "product_id").
value tinytext None null The name of the version

The "versions" table has no indexes.

The "votes" table

Field Type Default Properties Remarks
bug_id mediumint 0 - The bug (foreign key bugs.bug_id)
count smallint 0 - How many votes. Removed in 2.17.5 (replaced by "vote_count").
vote_count smallint 0 - How many votes. Added in 2.17.5 (replacing "count").
who mediumint 0 - The user (foreign key profiles.userid)

Indexes:

Name Fields Unique? Remarks
bug_id bug_id no -
who who no -

The "watch" table

Field Type Default Properties Remarks
watched mediumint 0 - The watched user (foreign key profiles.userid)
watcher mediumint 0 - The watching user (foreign key profiles.userid)

Indexes:

Name Fields Unique? Remarks
watched watched no -
watcher watcher, watched yes -

4. Example queries

To select a bug given the bug number:

select * from bugs where bug_id = %d

To select the long descriptions of a bug, together with the name and email address of the commenters:

select profiles.login_name, profiles.realname, longdescs.bug_when, longdescs.thetext from longdescs, profiles where profiles.userid = longdescs.who and longdescs.bug_id = %d order by longdescs.bug_when

To get a complete list of user ids and email addresses:

select userid, login_name from profiles

To find out a user's groupset:

select groupset from profiles where userid = %d

To get a user's email address:

select login_name from profiles where userid = %d

To get the set of cc addresses for a given bug:

select login_name from cc, profiles where cc.bug_id = %d and profiles.userid = cc.who

A. References

[RB 2000-08-30] "Design document structure" (e-mail message); Richard Brooksby; Ravenbrook Limited; 2000-08-30.
[RB 2000-10-05] "P4DTI Project Design Document Procedure"; Richard Brooksby; Ravenbrook Limited; 2000-10-05.

B. Document History

2000-11-14 NB Created.
2001-03-02 RB Transferred copyright to Perforce under their license.
2001-04-06 NB Added sample queries.
2001-09-12 NB Updated to reflect schema updates in Bugzilla 2.12 and 2.14
2002-01-31 NB Added notes on Bugzilla 2.14.1.
2002-05-31 NB Updated for Bugzilla 2.16 (based on 2.16rc1).
2002-09-26 NB Updated for Bugzilla 2.16/2.14.2/2.14.3.
2002-10-04 NB Added notes on Bugzilla 2.14.4 and 2.16.1, and on identical schemas.
2003-05-14 NB Added extensive notes on schema changes, in section 2.
2003-06-06 NB Added table of Bugzilla releases showing release date and support status.
2003-06-06 NB Added notes on schema changes in 2.17.x.
2003-06-13 NB Added first cut at description of new Bugzilla tables.
2003-06-27 NB Added more on recent schema changes. Colour-coded all schema changes.
2003-07-09 NB Completely changed the way this document is produced. The schema tables themselves are now created and coloured automatically by querying MySQL.
2003-11-04 NB Add Bugzilla 2.16.4 and 2.17.5.
2003-11-10 NB Add Bugzilla 2.17.6.

This document is copyright © 2001-2003 Perforce Software, Inc. All rights reserved.

Redistribution and use of this document in any form, with or without modification, is permitted provided that redistributions of this document retain the above copyright notice, this condition and the following disclaimer.

This document is provided by the copyright holders and contributors "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright holders and contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this document, even if advised of the possibility of such damage.

Generated by //info.ravenbrook.com/project/p4dti/version/2.1/design/bugzilla-schema/make_schema_doc.py#8
Using remarks from //info.ravenbrook.com/project/p4dti/version/2.1/design/bugzilla-schema/schema_remarks.py#10

Ravenbrook / Projects / Perforce Defect Tracking Integration / Version 2.1 Product Sources / Design