Merge "Move section ID fallbacks into headers themselves"
[lhc/web/wiklou.git] / maintenance / postgres / archives / patch-comment-table.sql
1 --
2 -- patch-comment-table.sql
3 --
4 -- T166732. Add a `comment` table, and temporary tables to reference it.
5
6 CREATE SEQUENCE comment_comment_id_seq;
7 CREATE TABLE comment (
8 comment_id INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('comment_comment_id_seq'),
9 comment_hash INTEGER NOT NULL,
10 comment_text TEXT NOT NULL,
11 comment_data TEXT
12 );
13 CREATE INDEX comment_hash ON comment (comment_hash);
14
15 CREATE TABLE revision_comment_temp (
16 revcomment_rev INTEGER NOT NULL,
17 revcomment_comment_id INTEGER NOT NULL,
18 PRIMARY KEY (revcomment_rev, revcomment_comment_id)
19 );
20 CREATE UNIQUE INDEX revcomment_rev ON revision_comment_temp (revcomment_rev);
21
22 CREATE TABLE image_comment_temp (
23 imgcomment_name TEXT NOT NULL,
24 imgcomment_description_id INTEGER NOT NULL,
25 PRIMARY KEY (imgcomment_name, imgcomment_description_id)
26 );
27 CREATE UNIQUE INDEX imgcomment_name ON image_comment_temp (imgcomment_name);