Index: branches/lqt-updates/extensions/LiquidThreads/new-schema.sql |
— | — | @@ -0,0 +1,123 @@ |
| 2 | +-- New LiquidThreads schema |
| 3 | +-- Original: Andrew Garrett, 2011-01-28 |
| 4 | +-- Updates: |
| 5 | + |
| 6 | + |
| 7 | +-- Channel table |
| 8 | +-- See LiquidThreadsChannel class |
| 9 | +CREATE TABLE /*_*/lqt_channel ( |
| 10 | + lqc_id bigint(10) unsigned not null auto_increment, |
| 11 | + |
| 12 | + -- NS/title pair of the talk page this channel is attached to. |
| 13 | + lqc_page_namespace int(2) not null, |
| 14 | + lqc_page_title varbinary(255) not null |
| 15 | +) /*$wgDBTableOptions*/; |
| 16 | + |
| 17 | +-- Topic table |
| 18 | +-- See LiquidThreadsTopic class |
| 19 | +CREATE TABLE /*_*/lqt_topic ( |
| 20 | + lqt_id bigint(10) unsigned not null auto_increment, |
| 21 | + |
| 22 | + -- The current version of this topic. |
| 23 | + -- Foreign key to lqt_topic_version.ltv_id |
| 24 | + lqt_current_version bigint(10) unsigned not null, |
| 25 | + |
| 26 | + -- Cache of the number of replies |
| 27 | + lqp_replies int unsigned not null, |
| 28 | + |
| 29 | + -- The Channel that this topic is contained in. |
| 30 | + -- Foreign key to lqt_channel.lqc_id |
| 31 | + lqt_channel bigint(10) unsigned not null, |
| 32 | +) /*$wgDBTableOptions*/; |
| 33 | + |
| 34 | +-- Topic Version table |
| 35 | +-- See LiquidThreadsTopicVersion class |
| 36 | +CREATE TABLE /*_*/lqt_topic_version ( |
| 37 | + ltv_id bigint(10) unsigned not null auto_increment, |
| 38 | + |
| 39 | + -- The topic to which this version applies |
| 40 | + -- Foreign key to lqt_topic.lqt_id |
| 41 | + ltv_topic bigint(10) unsigned not null, |
| 42 | + |
| 43 | + -- VERSION METADATA |
| 44 | + |
| 45 | + -- User IP/ID. One is set, the other is NULL |
| 46 | + ltv_user_id bigint(10) unsigned null, |
| 47 | + ltv_user_ip varbinary(64) null, |
| 48 | + -- Timestamp of the change |
| 49 | + ltv_timestamp varbinary(14) not null, |
| 50 | + -- Edit comment for this change, if applicable |
| 51 | + ltv_comment TINYBLOB, |
| 52 | + |
| 53 | + ltv_subject TINYBLOB NOT NULL, |
| 54 | + ltv_channel bigint(10) unsigned not null |
| 55 | +) /*$wgDBTableOptions*/; |
| 56 | + |
| 57 | +-- Post table |
| 58 | +-- See LiquidThreadsPost class |
| 59 | +CREATE TABLE /*_*/lqt_post ( |
| 60 | + lqp_id bigint(10) unsigned not null auto_increment, |
| 61 | + |
| 62 | + -- Current version of this post. |
| 63 | + -- Foreign key to lqt_topic_version.lpv_id |
| 64 | + lqp_current_version bigint(10) unsigned not null, |
| 65 | + |
| 66 | + -- Cache of the number of replies |
| 67 | + lqp_replies int unsigned not null, |
| 68 | + |
| 69 | + -- Everything below this is a cache of the content of the current version. |
| 70 | + -- It's here to simplify queries. |
| 71 | + |
| 72 | + -- Topic that this post currently belongs to. |
| 73 | + -- Foreign key to lqt_topic.lqt_id |
| 74 | + lqp_topic bigint(10) unsigned not null, |
| 75 | + |
| 76 | + -- Parent post. Potentially blank, if it's at the top level in the topic. |
| 77 | + -- Foreign key to lqt_post.lqp_id |
| 78 | + lqp_parent_post bigint(10) unsigned null |
| 79 | + |
| 80 | +) /*$wgDBTableOptions*/; |
| 81 | + |
| 82 | +-- Post Version table |
| 83 | +-- See LiquidThreadsPostVersion class |
| 84 | +CREATE TABLE /*_*/lqt_post_version ( |
| 85 | + lpv_id bigint(10) unsigned not null auto_increment, |
| 86 | + |
| 87 | + -- The post to which this version applies. |
| 88 | + -- Foreign key to lqt_post.lqp_id |
| 89 | + lpv_post bigint(10) unsigned not null, |
| 90 | + |
| 91 | + -- VERSION METADATA |
| 92 | + |
| 93 | + -- User IP/ID. One is set, the other is NULL |
| 94 | + lpv_user_id bigint(10) unsigned null, |
| 95 | + lpv_user_ip varbinary(64) null, |
| 96 | + -- Timestamp of the change |
| 97 | + lpv_timestamp varbinary(14) not null, |
| 98 | + -- Edit comment for this change, if applicable |
| 99 | + lpv_comment TINYBLOB, |
| 100 | + |
| 101 | + -- ACTUAL DATA |
| 102 | + |
| 103 | + -- User IP/ID for the ORIGINAL POSTER |
| 104 | + -- That is, the person to which this post is attributed. |
| 105 | + -- As with above, one is set, the other is NULL |
| 106 | + lpv_poster_id bigint(10) unsigned not null, |
| 107 | + lpv_poster_ip varbinary(64) null, |
| 108 | + |
| 109 | + -- Pointer to the text table, stores the comment text. |
| 110 | + -- Foreign key to text.old_id |
| 111 | + lpv_text_id bigint(10) unsigned not null, |
| 112 | + |
| 113 | + -- Ancestry, location. |
| 114 | + -- The topic that this post is a part of. |
| 115 | + -- Foreign key to lqt_topic.lqt_id |
| 116 | + lpv_topic bigint(10) unsigned not null, |
| 117 | + |
| 118 | + -- Parent post. Potentially blank, if it's at the top level in the topic. |
| 119 | + -- Foreign key to lqt_post.lqp_id |
| 120 | + lpv_parent_post bigint(10) unsigned null, |
| 121 | + |
| 122 | + -- Signature |
| 123 | + lpv_signature TINYBLOB NOT NULL |
| 124 | +) /*$wgDBTableOptions*/; |
Property changes on: branches/lqt-updates/extensions/LiquidThreads/new-schema.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 125 | + native |