← Back to team overview

launchpad-reviewers team mailing list archive

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

 


Diff comments:

> diff --git a/database/schema/patch-2210-31-0.sql b/database/schema/patch-2210-31-0.sql
> new file mode 100644
> index 0000000..593d214
> --- /dev/null
> +++ b/database/schema/patch-2210-31-0.sql
> @@ -0,0 +1,28 @@
> +-- 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_edited timestamp without time zone;
> +
> +CREATE TABLE MessageRevision (
> +    id serial PRIMARY KEY,
> +    message integer NOT NULL REFERENCES Message,
> +    date_created timestamp without time zone,

Right!

> +    date_deleted timestamp without time zone
> +);

It makes sense. I'll add the column here, so we don't need to change this table's structure once we implement subject editing too.

> +
> +CREATE UNIQUE INDEX messagerevision__message__date_created__key
> +    ON MessageRevision(message, date_created);

Sure.

> +
> +CREATE TABLE MessageRevisionChunk (
> +    id serial PRIMARY KEY,
> +    messagerevision integer NOT NULL REFERENCES MessageRevisionChunk,

Yep... wrong copy+paste mistake. Fixing it.

> +    sequence integer NOT NULL,
> +    content text NOT NULL
> +);

Even with the new editing feature, I expect that most Messages and MessageRevisions will never be updated (and even those ones updated will not change frequently, so VACUUM would take care of removing old tuples and keeping things in the same block). fillfactor=100 seems to be a reasonable choice in these cases too.

According to the docs, fillfactor=100 seems to be the default, but I'll add it explicitly.

> +
> +
> +INSERT INTO LaunchpadDatabaseRevision VALUES (2210, 31, 0);


-- 
https://code.launchpad.net/~pappacena/launchpad/+git/launchpad/+merge/401976
Your team Launchpad code reviewers is subscribed to branch ~pappacena/launchpad:comment-editing-db-patch.


References