SourcePackageRecipeDataInstruction.recipe_data should be NOT NULL
The sourcepackagerecipedatainstruction__name__recipe_data should be called
sourcepackagerecipedatainstruction__name__recipe_data__key. Similarly other unique constraints should end with __key.
Please change:
ALTER TABLE SourcePackageRecipeDataInstruction
ADD CONSTRAINT sourcepackagerecipedatainstruction__line_number__recipe_data
UNIQUE (line_number, recipe_data);
into the more useful to PostgreSQL variant:
ALTER TABLE SourcePackageRecipeDataInstruction ADD CONSTRAINT
sourcepackagerecipedatainstruction__recipe_data__line_number__key
UNIQUE (recipe_data, line_number);
sourcepackage is one word in Launchpad, so the .*source_package.* columns
need to be renamed .*sourcepackage.*.
As discussed on IRC and seen at http://pastebin.ubuntu.com/355335/, its better to make SourcepackageRecipeData reference recipe and build rather than the other way around, as we can then enforce the constraint that one and only one should be set.
Needed indexes:
CREATE INDEX sourcepackagerecipedata__base_branch__idx
ON SourcepackageRecipeData(base_branch);
CREATE INDEX sourcepackagerecipedatainstruction__branch__idx
ON SourcepackageRecipeDataInstruction(branch);
CREATE INDEX sourcepackagerecipe__registrant__idx
ON SourcepackageRecipe(registrant);
--CREATE INDEX sourcepackagerecipe__owner__idx
--ON SourcepackageRecipe(owner);
CREATE INDEX sourcepackagerecipebuild__distroseries__idx
ON SourcepackageRecipeBuild(distroseries);
CREATE INDEX sourcepackagerecipebuild__sourcepackagename__idx
ON SourcepackageRecipeBuild(sourcepackagename);
CREATE INDEX sourcepackagerecipebuild__build_log__idx
ON SourcepackageRecipeBuild(build_log) WHERE build_log IS NOT NULL;
CREATE INDEX sourcepackagerecipebuild__builder__idx
ON SourcepackageRecipeBuild(builder);
CREATE INDEX sourcepackagerecipebuild__requester__idx
ON SourcepackageRecipeBuild(requester);
CREATE INDEX sourcepackagerecipebuild__recipe__idx
ON SourcepackageRecipeBuild(recipe);
CREATE INDEX sourcepackagebuildupload__registrant__idx
ON SourcepackageRecipeBuildUpload(registrant);
Allocated patch number is patch-2207-25-0.sql
SourcePackageRe cipeDataInstruc tion.recipe_ data should be NOT NULL
The sourcepackagere cipedatainstruc tion__name_ _recipe_ data should be called cipedatainstruc tion__name_ _recipe_ data__key. Similarly other unique constraints should end with __key.
sourcepackagere
Please change:
ALTER TABLE SourcePackageRe cipeDataInstruc tion cipedatainstruc tion__line_ number_ _recipe_ data
ADD CONSTRAINT sourcepackagere
UNIQUE (line_number, recipe_data);
into the more useful to PostgreSQL variant:
ALTER TABLE SourcePackageRe cipeDataInstruc tion ADD CONSTRAINT cipedatainstruc tion__recipe_ data__line_ number_ _key
sourcepackagere
UNIQUE (recipe_data, line_number);
sourcepackage is one word in Launchpad, so the .*source_package.* columns
need to be renamed .*sourcepackage.*.
As discussed on IRC and seen at http:// pastebin. ubuntu. com/355335/, its better to make SourcepackageRe cipeData reference recipe and build rather than the other way around, as we can then enforce the constraint that one and only one should be set.
Needed indexes:
CREATE INDEX sourcepackagere cipedata_ _base_branch_ _idx cipeData( base_branch) ;
ON SourcepackageRe
CREATE INDEX sourcepackagere cipedatainstruc tion__branch_ _idx cipeDataInstruc tion(branch) ;
ON SourcepackageRe
CREATE INDEX sourcepackagere cipe__registran t__idx cipe(registrant );
ON SourcepackageRe
--CREATE INDEX sourcepackagere cipe__owner_ _idx cipe(owner) ;
--ON SourcepackageRe
CREATE INDEX sourcepackagere cipebuild_ _distroseries_ _idx cipeBuild( distroseries) ;
ON SourcepackageRe
CREATE INDEX sourcepackagere cipebuild_ _sourcepackagen ame__idx cipeBuild( sourcepackagena me);
ON SourcepackageRe
CREATE INDEX sourcepackagere cipebuild_ _build_ log__idx cipeBuild( build_log) WHERE build_log IS NOT NULL;
ON SourcepackageRe
CREATE INDEX sourcepackagere cipebuild_ _builder_ _idx cipeBuild( builder) ;
ON SourcepackageRe
CREATE INDEX sourcepackagere cipebuild_ _requester_ _idx cipeBuild( requester) ;
ON SourcepackageRe
CREATE INDEX sourcepackagere cipebuild_ _recipe_ _idx cipeBuild( recipe) ;
ON SourcepackageRe
CREATE INDEX sourcepackagebu ildupload_ _registrant_ _idx cipeBuildUpload (registrant) ;
ON SourcepackageRe