← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~lgp171188/launchpad:vulnerability-subscription-sql into launchpad:db-devel

 

Guruprasad has proposed merging ~lgp171188/launchpad:vulnerability-subscription-sql into launchpad:db-devel.

Commit message:
Add the VulnerabilitySubscription table

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/426864
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:vulnerability-subscription-sql into launchpad:db-devel.
diff --git a/database/schema/patch-2210-50-0.sql b/database/schema/patch-2210-50-0.sql
new file mode 100644
index 0000000..6618fc7
--- /dev/null
+++ b/database/schema/patch-2210-50-0.sql
@@ -0,0 +1,29 @@
+-- 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 VulnerabilitySubscription (
+    id serial PRIMARY KEY,
+    person integer REFERENCES Person NOT NULL,
+    vulnerability integer REFERENCES Vulnerability NOT NULL,
+    date_created timestamp without time zone DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'UTC') NOT NULL,
+    creator integer REFERENCES Person NOT NULL
+);
+
+COMMENT ON TABLE VulnerabilitySubscription IS '';
+COMMENT ON COLUMN VulnerabilitySubscription.person IS 'The person subscribing to the vulnerability.';
+COMMENT ON COLUMN VulnerabilitySubscription.vulnerability IS 'The vulnerability being subscribed to.';
+COMMENT ON COLUMN VulnerabilitySubscription.date_created IS 'The date when the subscription was created.';
+COMMENT ON COLUMN VulnerabilitySubscription.creator IS 'The person who created the subscription.';
+
+CREATE INDEX vulnerabilitysubscription__person__idx
+    ON VulnerabilitySubscription (person);
+
+CREATE INDEX vulnerabilitysubscription__vulnerability__idx
+    ON VulnerabilitySubscription (vulnerability);
+
+CREATE INDEX vulnerabilitysubscription__creator__idx
+    ON VulnerabilitySubscription (creator);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 50, 0);

Follow ups