Mercurial > ~dholland > hg > swallowtail > index.cgi
diff database/schema/messages.sql @ 54:36d91dfe017f
use valid sql syntax, mostly from yetoo on freenode
author | David A. Holland |
---|---|
date | Sun, 10 Apr 2022 17:41:24 -0400 (2022-04-10) |
parents | e1017d556437 |
children | 40f64a96481f |
line wrap: on
line diff
--- a/database/schema/messages.sql Sat Apr 02 21:15:27 2022 -0400 +++ b/database/schema/messages.sql Sun Apr 10 17:41:24 2022 -0400 @@ -42,19 +42,14 @@ -- for patches and mime-attachments CREATE TABLE attachments ( id bigint primary key default nextval('next_attachid'), - number_in_pr bigint not null, msgid bigint not null references messages (id), + number_in_msg bigint not null, mimetype text not null, body text not null ) WITHOUT OIDS; --- Create an index for number_in_pr both to enforce uniqueness and --- to enable lookup. +-- Create indexes for number_in_pr and number_in_msg both to enforce +-- uniqueness and to enable lookup. CREATE UNIQUE INDEX ON messages (pr, number_in_pr); --- XXX: does this work? -CREATE UNIQUE INDEX ON - SELECT messages.pr, attachments.number_in_pr - FROM messages, attachments - WHERE messages.id = attachments.msgid -; +CREATE UNIQUE INDEX ON attachments (msgid, number_in_msg);