Merge lp://staging/~bryce/launchpad/lp-644794-db-foreign-keys into lp://staging/launchpad/db-devel
Status: | Merged |
---|---|
Approved by: | Bryce Harrington |
Approved revision: | no longer in the source branch. |
Merged at revision: | 9876 |
Proposed branch: | lp://staging/~bryce/launchpad/lp-644794-db-foreign-keys |
Merge into: | lp://staging/launchpad/db-devel |
Diff against target: |
58 lines (+26/-6) 3 files modified
database/schema/comments.sql (+2/-1) database/schema/patch-2208-19-0.sql (+24/-0) lib/lp/bugs/model/bugtracker.py (+0/-5) |
To merge this branch: | bzr merge lp://staging/~bryce/launchpad/lp-644794-db-foreign-keys |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stuart Bishop (community) | db | Approve | |
Robert Collins | db | Pending | |
Review via email: mp+37543@code.staging.launchpad.net |
Commit message
Switch out a link to DistroSourcePac
Description of the change
This change switches out a link to DistroSourcePac
I found when trying to hook up to DSP, that the table didn't provide anything. Below is an email from Gavin explaining why it didn't work, and recommending use of Distribution and SourcePackage links instead.
"""
There's no guarantee that a DistributionSou
backed-up by anything in the database. Indeed, until
DistributionSou
be nothing at all.
In addition, DistributionSou
private, only for the use of DistributionSou
they'll merge, but I don't think that can happen just yet (and that's
something that the Soyuz team will manage I guess).
So, as far as I am aware, the normal way to refer to a source package
in a distribution is to store both the distribution and the source
package name. For example, the BugTask table has distribution and
sourcepackagename columns. In Python, you'd then get the Distribution
and the SourcePackageName, then call
distribution.
Note that the package name is actually a row in SourcePackageName;
although Distribution.
immediately look it up in SourcePackageName.
"""
Fine in general.
We need an index. The old column is UNIQUE, so I suspect the new columns need to be UNIQUE too:
ALTER TABLE BugTrackerComponent ADD CONSTRAINT bugtrackercompo nent__disto_ _spn__key package_ name);
UNIQUE (distribution, source_
We also should add a constraint ensuring that if distribution is set, source_package_name is also set:
ALTER TABLE BugTrackerComponent ADD CONSTRAINT valid_target
CHECK (distribution IS NULL = source_package_name IS NULL);
You will need to adjust the comments in comments.sql before this can land.
patch-2208-19-0.sql