Merge ~pappacena/launchpad:merge-db-stable into launchpad:master

Proposed by Thiago F. Pappacena
Status: Merged
Approved by: Thiago F. Pappacena
Approved revision: 6d412dafb1959d2eef85de03c10e924666d2fa51
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~pappacena/launchpad:merge-db-stable
Merge into: launchpad:master
Diff against target: 56 lines (+50/-0)
1 file modified
database/schema/patch-2210-31-0.sql (+50/-0)
Reviewer Review Type Date Requested Status
Thiago F. Pappacena (community) Approve
Review via email:

Commit message

Merge db-stable 6d412dafb1959d2eef85de03c10e924666d2fa51 (MessageRevision and MessageRevisionChunk tables, and adding columns for last edit and delete date on Message)

To post a comment you must log in.
Revision history for this message
Thiago F. Pappacena (pappacena) wrote :

Deployed to the production database today.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/database/schema/patch-2210-31-0.sql b/database/schema/patch-2210-31-0.sql
2new file mode 100644
3index 0000000..8c11aac
4--- /dev/null
5+++ b/database/schema/patch-2210-31-0.sql
6@@ -0,0 +1,50 @@
7+-- Copyright 2021 Canonical Ltd. This software is licensed under the
8+-- GNU Affero General Public License version 3 (see the file LICENSE).
10+SET client_min_messages=ERROR;
12+ALTER TABLE Message
13+ ADD COLUMN date_deleted timestamp without time zone,
14+ ADD COLUMN date_last_edited timestamp without time zone;
16+CREATE TABLE MessageRevision (
17+ id serial PRIMARY KEY,
18+ message integer NOT NULL REFERENCES Message,
19+ revision integer NOT NULL,
20+ subject text,
21+ date_created timestamp without time zone NOT NULL,
22+ date_deleted timestamp without time zone
23+) WITH (fillfactor='100');
25+CREATE UNIQUE INDEX messagerevision__message__revision__key
26+ ON MessageRevision(message, revision);
28+COMMENT ON TABLE MessageRevision IS 'Old versions of an edited Message';
29+COMMENT ON COLUMN MessageRevision.message
30+ IS 'The current message of this revision';
31+COMMENT ON COLUMN MessageRevision.revision
32+ IS 'The revision monotonic increasing number';
33+COMMENT ON COLUMN MessageRevision.date_created
34+ IS 'When the original message was edited and created this revision';
35+COMMENT ON COLUMN MessageRevision.date_deleted
36+ IS 'If this revision was deleted, when did that happen';
39+CREATE TABLE MessageRevisionChunk (
40+ id serial PRIMARY KEY,
41+ messagerevision integer NOT NULL REFERENCES MessageRevision,
42+ sequence integer NOT NULL,
43+ content text NOT NULL
44+) WITH (fillfactor='100');
46+CREATE UNIQUE INDEX messagerevisionchunk__messagerevision__sequence__key
47+ ON MessageRevisionChunk(messagerevision, sequence);
49+COMMENT ON TABLE MessageRevisionChunk
50+ IS 'Old chunks of a message when a revision was created for it';
51+COMMENT ON COLUMN MessageRevisionChunk.sequence
52+ IS 'Order of this particular chunk';
53+COMMENT ON COLUMN MessageRevisionChunk.content
54+ IS 'Text content for this chunk of the message.';
56+INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 31, 0);