Merge lp:~sinzui/launchpad/packaging-constraint-bug-196774 into lp:launchpad/db-devel

Proposed by Curtis Hovey
Status: Merged
Approved by: Jonathan Lange
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~sinzui/launchpad/packaging-constraint-bug-196774
Merge into: lp:launchpad/db-devel
Diff against target: 14 lines (+10/-0)
1 file modified
database/schema/patch-2207-09.0.sql (+10/-0)
To merge this branch: bzr merge lp:~sinzui/launchpad/packaging-constraint-bug-196774
Reviewer Review Type Date Requested Status
Jonathan Lange (community) db Approve
Stuart Bishop (community) db Approve
Review via email: mp+14677@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

This is my branch to fix the packaging uniquneess constraint.

    lp:~sinzui/launchpad/packaging-constraint-bug-196774
    Diff size: 15
    Launchpad bug: https://bugs.launchpad.net/bugs/196774
    Test command: ./bin/test -vvt "packag"
    Pre-implementation: flacoste
    Target release: 3.1.11

= Fix the packaging uniqueness constraint =

The unique constraint specified on the Packaging table is
(distroseries, sourcepackagename, productseries).

It should really be (distroseries, sourcepackagename). Since there will be
only one active link at a time (otherwise, they'll be different
sourcepackagenames).

The productseries packaging views were updated to not create a duplicate
packaging links. The sourcepackage knew not to create an link if one already
existed but did not know if other links existed. Fixing both points of
conflict prevents several kinds of OOPS that can occur because the code
assumed it was harmless to create multiple links to the same sourcepackagename
in a distroseries. The project +packaging page was updated to allow users to
delete erroneous links--I used the feature to to delete all the duplicate
packaging links in production.

== Rules ==

    * change the constraint to (distroseries, sourcepackagename)

== QA ==

    * No callsite should try to create a duplicate package now, but if
      I am wrong we will see an integrity error in the OOPS reports.

== Lint ==

Linting changed files:
  database/schema/patch-2207-97.0.sql

== Test ==

    * Ran all the tests with 'packag' in their name

== Implementation ==

    * database/schema/patch-2207-97.0.sql
      * Added a simple constraint change.

Revision history for this message
Stuart Bishop (stub) wrote :

Fine.

The constraint name should be packaging__distroseries__sourcepackagename__key

Patch number is patch-2207-09-0.sql

review: Approve (db)
Revision history for this message
Jonathan Lange (jml) wrote :

Thanks.

review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2207-09.0.sql'
2--- database/schema/patch-2207-09.0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2207-09.0.sql 2009-11-10 04:34:11 +0000
4@@ -0,0 +1,10 @@
5+SET client_min_messages=ERROR;
6+
7+-- Per Bug #196774
8+ALTER TABLE Packaging
9+ DROP CONSTRAINT packaging_uniqueness,
10+ ADD CONSTRAINT packaging__distroseries__sourcepackagename__key
11+ UNIQUE (distroseries, sourcepackagename);
12+
13+INSERT INTO LaunchpadDatabaseRevision VALUES (2207, 9, 0);
14+

Subscribers

People subscribed via source and target branches

to status/vote changes: