Index: branches/lqt-updates/extensions/LiquidThreads/new-schema.sql |
— | — | @@ -6,20 +6,20 @@ |
7 | 7 | -- Channel table |
8 | 8 | -- See LiquidThreadsChannel class |
9 | 9 | CREATE TABLE /*_*/lqt_channel ( |
10 | | - lqc_id bigint(10) unsigned not null auto_increment, |
| 10 | + lqc_id bigint(10) unsigned primary key not null auto_increment, |
11 | 11 | |
12 | 12 | -- NS/title pair of the talk page this channel is attached to. |
13 | 13 | lqc_page_namespace int(2) not null, |
14 | | - lqc_page_title varbinary(255) not null, |
15 | | - |
16 | | - PRIMARY KEY (lqc_id), |
17 | | - UNIQUE KEY (lqc_page_namespace,lqc_page_title) |
| 14 | + lqc_page_title varbinary(255) not null |
18 | 15 | ) /*$wgDBTableOptions*/; |
19 | 16 | |
| 17 | +CREATE UNIQUE INDEX /*i*/lqc_page_namespace_title ON /*_*/lqt_channel (lqc_page_namespace, lqc_page_title); |
| 18 | + |
| 19 | + |
20 | 20 | -- Topic table |
21 | 21 | -- See LiquidThreadsTopic class |
22 | 22 | CREATE TABLE /*_*/lqt_topic ( |
23 | | - lqt_id bigint(10) unsigned not null auto_increment, |
| 23 | + lqt_id bigint(10) unsigned PRIMARY KEY not null auto_increment, |
24 | 24 | |
25 | 25 | -- The current version of this topic. |
26 | 26 | -- Foreign key to lqt_topic_version.ltv_id |
— | — | @@ -30,16 +30,16 @@ |
31 | 31 | |
32 | 32 | -- The Channel that this topic is contained in. |
33 | 33 | -- Foreign key to lqt_channel.lqc_id |
34 | | - lqt_channel bigint(10) unsigned not null, |
35 | | - |
36 | | - PRIMARY KEY (lqt_id), |
37 | | - KEY (lqt_channel) |
| 34 | + lqt_channel bigint(10) unsigned not null |
38 | 35 | ) /*$wgDBTableOptions*/; |
39 | 36 | |
| 37 | +CREATE INDEX /*i*/lqt_topic_channel ON /*_*/lqt_topic (lqt_channel); |
| 38 | + |
| 39 | + |
40 | 40 | -- Topic Version table |
41 | 41 | -- See LiquidThreadsTopicVersion class |
42 | 42 | CREATE TABLE /*_*/lqt_topic_version ( |
43 | | - ltv_id bigint(10) unsigned not null auto_increment, |
| 43 | + ltv_id bigint(10) unsigned PRIMARY KEY not null auto_increment, |
44 | 44 | |
45 | 45 | -- The topic to which this version applies |
46 | 46 | -- Foreign key to lqt_topic.lqt_id |
— | — | @@ -63,17 +63,17 @@ |
64 | 64 | ltv_summary_text_id bigint(10) unsigned not null, |
65 | 65 | |
66 | 66 | ltv_subject TINYBLOB NOT NULL, |
67 | | - ltv_channel bigint(10) unsigned not null, |
68 | | - |
69 | | - PRIMARY KEY (ltv_id), |
70 | | - KEY (ltv_topic, ltv_timestamp), |
71 | | - KEY (ltv_user_id,ltv_user_ip) |
| 67 | + ltv_channel bigint(10) unsigned not null |
72 | 68 | ) /*$wgDBTableOptions*/; |
73 | 69 | |
| 70 | +CREATE INDEX /*i*/ltv_topic_timestamp ON /*_*/lqt_topic_version (ltv_topic, ltv_timestamp); |
| 71 | +CREATE INDEX /*i*/ltv_user_id_ip ON /*_*/lqt_topic_version (ltv_user_id, ltv_user_ip); |
| 72 | + |
| 73 | + |
74 | 74 | -- Post table |
75 | 75 | -- See LiquidThreadsPost class |
76 | 76 | CREATE TABLE /*_*/lqt_post ( |
77 | | - lqp_id bigint(10) unsigned not null auto_increment, |
| 77 | + lqp_id bigint(10) unsigned PRIMARY KEY not null auto_increment, |
78 | 78 | |
79 | 79 | -- Current version of this post. |
80 | 80 | -- Foreign key to lqt_topic_version.lpv_id |
— | — | @@ -91,17 +91,16 @@ |
92 | 92 | |
93 | 93 | -- Parent post. Potentially blank, if it's at the top level in the topic. |
94 | 94 | -- Foreign key to lqt_post.lqp_id |
95 | | - lqp_parent_post bigint(10) unsigned null, |
96 | | - |
97 | | - PRIMARY KEY (lqp_id), |
98 | | - KEY (lqp_topic, lqp_parent_post) |
99 | | - |
| 95 | + lqp_parent_post bigint(10) unsigned null |
100 | 96 | ) /*$wgDBTableOptions*/; |
101 | 97 | |
| 98 | +CREATE INDEX /*i*/lqp_topic_parent ON /*_*/lqt_post (lqp_topic, lqp_parent_post); |
| 99 | + |
| 100 | + |
102 | 101 | -- Post Version table |
103 | 102 | -- See LiquidThreadsPostVersion class |
104 | 103 | CREATE TABLE /*_*/lqt_post_version ( |
105 | | - lpv_id bigint(10) unsigned not null auto_increment, |
| 104 | + lpv_id bigint(10) unsigned PRIMARY KEY not null auto_increment, |
106 | 105 | |
107 | 106 | -- The post to which this version applies. |
108 | 107 | -- Foreign key to lqt_post.lqp_id |
— | — | @@ -142,8 +141,7 @@ |
143 | 142 | lpv_parent_post bigint(10) unsigned null, |
144 | 143 | |
145 | 144 | -- Signature |
146 | | - lpv_signature TINYBLOB NOT NULL, |
147 | | - |
148 | | - PRIMARY KEY (lpv_id), |
149 | | - KEY (lpv_post, lpv_timestamp) |
| 145 | + lpv_signature TINYBLOB NOT NULL |
150 | 146 | ) /*$wgDBTableOptions*/; |
| 147 | + |
| 148 | +CREATE INDEX /*i*/lpv_post_timestamp ON /*_*/lqt_post_version (lpv_post, lpv_timestamp); |