← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~bryceharrington/launchpad/lp-617679-db into lp:launchpad

 

Bryce Harrington has proposed merging lp:~bryceharrington/launchpad/lp-617679-db into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #617679 Extend bugtracker models to include product/component mappings
  https://bugs.launchpad.net/bugs/617679


This branch is a foundation for changes to add support for mapping additional form data for external bug trackers, in order to simplify the process of forwarding bug reports upstream.

Specifically, it adds tables for components and component groups (aka 'products' in bugzilla).  A bug tracker can have one or many component groups, and each component group can have any number of components.  Components are the equivalent to distro source packages, and we allow linkages to be made between them.

These tables will be filled via a daily cron script that retrieves the data from the upstream bug trackers.  Users can add to or delete items as well.  The is_custom flag allows marking user-added items (which should not be removed by the cron job).  The is_active flag allows the user to disable/hide synced components which are not relevant.

pre-implementation and mid-implementation discussions of this feature were done with Deryck and Graham.

The branch has passed 'make schema', and I've verified the patch applies.
-- 
https://code.launchpad.net/~bryceharrington/launchpad/lp-617679-db/+merge/34321
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~bryceharrington/launchpad/lp-617679-db into lp:launchpad.
=== modified file 'database/schema/comments.sql'
--- database/schema/comments.sql	2010-08-31 09:42:59 +0000
+++ database/schema/comments.sql	2010-09-01 17:53:47 +0000
@@ -346,6 +346,21 @@
 COMMENT ON COLUMN BugTrackerPerson.name IS 'The (within the bug tracker) unique username in the external bug tracker.';
 COMMENT ON COLUMN BugTrackerPerson.person IS 'The Person record in Launchpad this user corresponds to.';
 
+-- BugTrackerComponent
+
+COMMENT ON TABLE BugTrackerComponent IS 'A software component in a remote bug tracker, which can be linked to the corresponding source package in a distribution using this table.';
+COMMENT ON COLUMN BugTrackerComponent.name IS 'The name of the component as registered in the remote bug tracker.';
+COMMENT ON COLUMN BugTrackerComponent.is_active IS 'Whether to display or hide the item in the Launchpad user interface.';
+COMMENT ON COLUMN BugTrackerComponent.is_custom IS 'Whether the item was added by a user in Launchpad or is kept in sync with the remote bug tracker.';
+COMMENT ON COLUMN BugTrackerComponent.component_group IS 'The product or other higher level category used by the remote bug tracker to group projects.  Some bug trackers do not group components thus all BugTrackerComponents will belong to a default componentgroup.';
+COMMENT ON COLUMN BugTrackerComponent.source_package IS 'A link to the source package in a distribution that corresponds to this component.  This can be undefined if no link has been established yet.';
+
+-- BugTrackerComponentGroup
+
+COMMENT ON TABLE BugTrackerComponentGroup IS 'A collection of components as modeled in a remote bug tracker, often referred to as a product.  Some bug trackers do not categorize software components this way, so they will have a single default component group that all components belong to.';
+COMMENT ON COLUMN BugTrackerComponentGroup.name IS 'The product or category name used in the remote bug tracker for grouping components.';
+COMMENT ON COLUMN BugTrackerComponentGroup.bug_tracker IS 'The external bug tracker this component group belongs to.';
+
 -- BugCve
 
 COMMENT ON TABLE BugCve IS 'A table that records the link between a given malone bug number, and a CVE entry.';

=== added file 'database/schema/patch-2208-99-0.sql'
--- database/schema/patch-2208-99-0.sql	1970-01-01 00:00:00 +0000
+++ database/schema/patch-2208-99-0.sql	2010-09-01 17:53:47 +0000
@@ -0,0 +1,33 @@
+-- Copyright 2010 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+CREATE TABLE BugTrackerComponentGroup (
+    id serial PRIMARY KEY,
+    name text NOT NULL,
+    bug_tracker integer NOT NULL REFERENCES BugTracker
+);
+
+CREATE INDEX bugtrackercomponentgroup__bugtracker__idx
+    ON BugTracker(id);
+
+CREATE TABLE BugTrackerComponent (
+    id serial PRIMARY KEY,
+    name text NOT NULL,
+    is_active boolean DEFAULT True,
+    is_custom boolean DEFAULT True,
+    component_group integer NOT NULL REFERENCES BugTrackerComponentGroup,
+    source_package integer REFERENCES DistributionSourcePackage,
+
+    -- There should be only one component per source package
+    CONSTRAINT bugtrackercomponent__distributionsourcepackage__fk
+        FOREIGN KEY(source_package) REFERENCES DistributionSourcePackage
+);
+
+CREATE INDEX bugtrackercomponent__componentgroup__idx
+    ON BugTrackerComponent(component_group);
+CREATE INDEX bugtrackercomponent__distributionsourcepackage__idx
+    ON BugTrackerComponent(source_package);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES(2208, 99, 0);


Follow ups