Code review comment for lp://staging/~bryce/launchpad/lp-617679-db

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

Allocated DB patch is patch-2208-09-0.sql

Missing constraint on BugTrackerComponentGroup:

ALTER TABLE BugTrackerComponentGroup
    ADD CONSTRAINT bugtrackercomponentgroup__bug_tracker__name__key
    UNIQUE (bug_tracker, name);

The bugtrackercomponentgroup__bugtracker__idx index is incorrect (you reference the wrong table). I suspect you wanted the index on BugTrackerComponentGroup(bugtracker), which is now unnecessary with the above constraint, so just drop it.

On BugTrackerComponent:

    - you are declaring the source_package foreign key twice. Either remove the REFERENCES clause in the column definition, or the CONSTRAINT clause after the column definitions.

    - The boolean columns are missing NOT NULL constraints.

    - Missing constraint on (component_group, name).

      ALTER TABLE BugTrackerComponent
        ADD CONSTRAINT bugtrackercomponent__component_group__name__key
        UNIQUE (component_group, name);

    - The bugtrackercomponent__componentgroup__idx index becomes unnecessary
      with the above constraint.

    - I'm not sure if source_package should be UNIQUE. I suspect it is.

      ALTER TABLE BugTrackerComponent
        ADD CONSTRAINT bugtrackercomponent__source_package__key
        UNIQUE (source_package);

    - If the above UNIQUE constraint on source_package is added, the
      bugtrackercomponent__distributionsourcepackage__idx index is
      unnecessary. It has the wrong name anyway
      (bugtrackercomponent__source_package__idx).

review: Needs Fixing (db)

« Back to merge proposal