← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~pappacena/launchpad:comment-editing-db-patch into launchpad:db-devel

 

Thiago F. Pappacena has proposed merging ~pappacena/launchpad:comment-editing-db-patch into launchpad:db-devel.

Commit message:
Database patch for comment editing feature

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/401976
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~pappacena/launchpad:comment-editing-db-patch into launchpad:db-devel.
diff --git a/database/schema/patch-2210-31-0.sql b/database/schema/patch-2210-31-0.sql
new file mode 100644
index 0000000..9bcceb5
--- /dev/null
+++ b/database/schema/patch-2210-31-0.sql
@@ -0,0 +1,21 @@
+-- Copyright 2021 Canonical Ltd.  This software is licensed under the
+-- GNU Affero General Public License version 3 (see the file LICENSE).
+
+SET client_min_messages=ERROR;
+
+ALTER TABLE Message
+    ADD COLUMN date_deleted timestamp without time zone,
+    ADD COLUMN date_last_edit timestamp without time zone;
+
+CREATE TABLE MessageRevision (
+    id serial PRIMARY KEY,
+    message integer NOT NULL REFERENCES Message,
+    content text,
+    date_created timestamp without time zone,
+    date_deleted timestamp without time zone
+);
+
+CREATE UNIQUE INDEX messagerevision__message__date_created__key
+    ON MessageRevision(message, date_created);
+
+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 31, 0);

Follow ups