launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29322
[Merge] ~andrey-fedoseev/launchpad:db-bug-presence into launchpad:db-devel
Andrey Fedoseev has proposed merging ~andrey-fedoseev/launchpad:db-bug-presence into launchpad:db-devel.
Commit message:
Add `BugPresence` table
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~andrey-fedoseev/launchpad/+git/launchpad/+merge/431711
It represents a range of versions or git commits in which the bug was present.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~andrey-fedoseev/launchpad:db-bug-presence into launchpad:db-devel.
diff --git a/database/schema/patch-2211-12-0.sql b/database/schema/patch-2211-12-0.sql
new file mode 100644
index 0000000..24ecf86
--- /dev/null
+++ b/database/schema/patch-2211-12-0.sql
@@ -0,0 +1,60 @@
+-- Copyright 2022 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 BugPresence
+(
+ id serial PRIMARY KEY,
+ bug integer NOT NULL REFERENCES Bug ON DELETE CASCADE,
+ project integer REFERENCES Product ON DELETE CASCADE,
+ distribution integer REFERENCES Distribution ON DELETE CASCADE,
+ sourcepackagename integer REFERENCES SourcePackageName ON DELETE CASCADE,
+ git_repository integer REFERENCES GitRepository ON DELETE CASCADE,
+ broken_version text,
+ fixed_version text,
+ broken_git_commit_sha1 varchar(40),
+ fixed_git_commit_sha1 varchar(40),
+ CONSTRAINT version_or_git_range CHECK ((
+ broken_version is NULL
+ and fixed_version is NULL
+ and project is NULL
+ and distribution is NULL
+ and BugPresence.sourcepackagename is NULL
+ ) != (
+ broken_git_commit_sha1 is NULL
+ and fixed_git_commit_sha1 is NULL
+ and git_repository is NULL
+ )),
+ CONSTRAINT version_range_target CHECK (
+ (
+ broken_version is not NULL
+ or BugPresence.fixed_version is not NULL
+ ) = (
+ project is not NULL
+ or distribution is not NULL
+ or BugPresence.sourcepackagename is not NULL
+ )
+ ),
+ CONSTRAINT git_range_target CHECK (
+ (
+ broken_git_commit_sha1 is not NULL
+ or fixed_git_commit_sha1 is not NULL
+ ) = (git_repository is not NULL)
+ )
+);
+
+CREATE INDEX BugPresence__bug__idx ON BugPresence(bug);
+
+COMMENT ON TABLE BugPresence IS 'Range of versions or git commits in which the bug is present.';
+COMMENT ON COLUMN BugPresence.bug is 'The Bug this BugPresence related to.';
+COMMENT ON COLUMN BugPresence.project is 'The project in which the bug is present.';
+COMMENT ON COLUMN BugPresence.distribution is 'The distribution in which the bug is present.';
+COMMENT ON COLUMN BugPresence.sourcepackagename is 'The package in which the bug is present.';
+COMMENT ON COLUMN BugPresence.git_repository is 'The git repository in which the bug is present.';
+COMMENT ON COLUMN BugPresence.broken_version is 'The version in which the bug was introduced.';
+COMMENT ON COLUMN BugPresence.fixed_version is 'The version in which the bug was fixed.';
+COMMENT ON COLUMN BugPresence.broken_git_commit_sha1 is 'The git commit in which the bug was introduced.';
+COMMENT ON COLUMN BugPresence.fixed_git_commit_sha1 is 'The git commit in which the bug was fixed.';
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2211, 12, 0);
diff --git a/database/schema/security.cfg b/database/schema/security.cfg
index a7f801b..4d5ab4f 100644
--- a/database/schema/security.cfg
+++ b/database/schema/security.cfg
@@ -147,6 +147,7 @@ public.bugnotification = SELECT, INSERT, UPDATE, DELETE
public.bugnotificationattachment = SELECT, INSERT
public.bugnotificationfilter = SELECT, INSERT, UPDATE, DELETE
public.bugnotificationrecipient = SELECT, INSERT, UPDATE, DELETE
+public.bugpresence = SELECT, INSERT, UPDATE, DELETE
public.bugsummary = SELECT
public.bugsummaryjournal = SELECT
public.bugsummary_rollup_journal(integer) = EXECUTE