schema.sql
changeset 279 8acd77a6c19d
parent 266 917dcc6c4ceb
parent 275 956263992d48
child 304 e2cb5f1432c8
equal deleted inserted replaced
278:53ba55d33abb 279:8acd77a6c19d
    12 
    12 
    13 CREATE TABLE {{TABLE_PREFIX}}categories(
    13 CREATE TABLE {{TABLE_PREFIX}}categories(
    14   page_id varchar(64),
    14   page_id varchar(64),
    15   namespace varchar(64),
    15   namespace varchar(64),
    16   category_id varchar(64)
    16   category_id varchar(64)
    17 ) CHARACTER SET `utf8`;
    17 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    18 
    18 
    19 CREATE TABLE {{TABLE_PREFIX}}comments(
    19 CREATE TABLE {{TABLE_PREFIX}}comments(
    20   comment_id int(12) NOT NULL auto_increment,
    20   comment_id int(12) NOT NULL auto_increment,
    21   page_id text,
    21   page_id text,
    22   namespace text,
    22   namespace text,
    25   name text,
    25   name text,
    26   approved tinyint(1) default 1,
    26   approved tinyint(1) default 1,
    27   user_id mediumint(8) NOT NULL DEFAULT -1,
    27   user_id mediumint(8) NOT NULL DEFAULT -1,
    28   time int(12) NOT NULL DEFAULT 0,
    28   time int(12) NOT NULL DEFAULT 0,
    29   PRIMARY KEY ( comment_id )
    29   PRIMARY KEY ( comment_id )
    30 ) CHARACTER SET `utf8`;
    30 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    31 
    31 
    32 CREATE TABLE {{TABLE_PREFIX}}config(
    32 CREATE TABLE {{TABLE_PREFIX}}config(
    33   config_name varchar(63),
    33   config_name varchar(63),
    34   config_value text
    34   config_value text
    35 ) CHARACTER SET `utf8`;
    35 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    36 
    36 
    37 CREATE TABLE {{TABLE_PREFIX}}logs(
    37 CREATE TABLE {{TABLE_PREFIX}}logs(
    38   log_type varchar(16),
    38   log_type varchar(16),
    39   action varchar(16),
    39   action varchar(16),
    40   time_id int(12) NOT NULL default '0',
    40   time_id int(12) NOT NULL default '0',
    44   page_text text,
    44   page_text text,
    45   char_tag varchar(40),
    45   char_tag varchar(40),
    46   author varchar(63),
    46   author varchar(63),
    47   edit_summary text,
    47   edit_summary text,
    48   minor_edit tinyint(1)
    48   minor_edit tinyint(1)
    49 ) CHARACTER SET `utf8`;
    49 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    50 
    50 
    51 CREATE TABLE {{TABLE_PREFIX}}page_text(
    51 CREATE TABLE {{TABLE_PREFIX}}page_text(
    52   page_id varchar(63),
    52   page_id varchar(63),
    53   namespace varchar(16) NOT NULL default 'Article',
    53   namespace varchar(16) NOT NULL default 'Article',
    54   page_text text,
    54   page_text text,
    67   protected tinyint(1) NOT NULL DEFAULT 0,
    67   protected tinyint(1) NOT NULL DEFAULT 0,
    68   wiki_mode tinyint(1) NOT NULL DEFAULT 2,
    68   wiki_mode tinyint(1) NOT NULL DEFAULT 2,
    69   delvotes int(10) NOT NULL default 0,
    69   delvotes int(10) NOT NULL default 0,
    70   password varchar(40) NOT NULL DEFAULT '',
    70   password varchar(40) NOT NULL DEFAULT '',
    71   delvote_ips text DEFAULT NULL
    71   delvote_ips text DEFAULT NULL
    72 ) CHARACTER SET `utf8`;
    72 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    73 
    73 
    74 CREATE TABLE {{TABLE_PREFIX}}session_keys(
    74 CREATE TABLE {{TABLE_PREFIX}}session_keys(
    75   session_key varchar(32),
    75   session_key varchar(32),
    76   salt varchar(32),
    76   salt varchar(32),
    77   user_id mediumint(8),
    77   user_id mediumint(8),
    78   auth_level tinyint(1) NOT NULL default '0',
    78   auth_level tinyint(1) NOT NULL default '0',
    79   source_ip varchar(10) default '0x7f000001',
    79   source_ip varchar(10) default '0x7f000001',
    80   time bigint(15) default '0'
    80   time bigint(15) default '0'
    81 ) CHARACTER SET `utf8`;
    81 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    82 
    82 
    83 CREATE TABLE {{TABLE_PREFIX}}themes(
    83 CREATE TABLE {{TABLE_PREFIX}}themes(
    84   theme_id varchar(63),
    84   theme_id varchar(63),
    85   theme_name text,
    85   theme_name text,
    86   theme_order smallint(5) NOT NULL default '1',
    86   theme_order smallint(5) NOT NULL default '1',
    87   default_style varchar(63) NOT NULL DEFAULT '',
    87   default_style varchar(63) NOT NULL DEFAULT '',
    88   enabled tinyint(1) NOT NULL default '1'
    88   enabled tinyint(1) NOT NULL default '1'
    89 ) CHARACTER SET `utf8`;
    89 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    90 
    90 
    91 CREATE TABLE {{TABLE_PREFIX}}users(
    91 CREATE TABLE {{TABLE_PREFIX}}users(
    92   user_id mediumint(8) NOT NULL auto_increment,
    92   user_id mediumint(8) NOT NULL auto_increment,
    93   username text,
    93   username text,
    94   password varchar(255),
    94   password varchar(255),
   105   temp_password text,
   105   temp_password text,
   106   temp_password_time int(12) NOT NULL DEFAULT 0,
   106   temp_password_time int(12) NOT NULL DEFAULT 0,
   107   user_coppa tinyint(1) NOT NULL DEFAULT 0,
   107   user_coppa tinyint(1) NOT NULL DEFAULT 0,
   108   user_lang smallint(5) NOT NULL,
   108   user_lang smallint(5) NOT NULL,
   109   PRIMARY KEY  (user_id)
   109   PRIMARY KEY  (user_id)
   110 ) CHARACTER SET `utf8`;
   110 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   111 
   111 
   112 CREATE TABLE {{TABLE_PREFIX}}users_extra(
   112 CREATE TABLE {{TABLE_PREFIX}}users_extra(
   113   user_id mediumint(8) NOT NULL,
   113   user_id mediumint(8) NOT NULL,
   114   user_aim varchar(63),
   114   user_aim varchar(63),
   115   user_yahoo varchar(63),
   115   user_yahoo varchar(63),
   119   user_location text,
   119   user_location text,
   120   user_job text,
   120   user_job text,
   121   user_hobbies text,
   121   user_hobbies text,
   122   email_public tinyint(1) NOT NULL DEFAULT 0,
   122   email_public tinyint(1) NOT NULL DEFAULT 0,
   123   PRIMARY KEY ( user_id ) 
   123   PRIMARY KEY ( user_id ) 
   124 ) CHARACTER SET `utf8`;
   124 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   125 
   125 
   126 CREATE TABLE {{TABLE_PREFIX}}banlist(
   126 CREATE TABLE {{TABLE_PREFIX}}banlist(
   127   ban_id mediumint(8) NOT NULL auto_increment,
   127   ban_id mediumint(8) NOT NULL auto_increment,
   128   ban_type tinyint(1),
   128   ban_type tinyint(1),
   129   ban_value varchar(64),
   129   ban_value varchar(64),
   130   is_regex tinyint(1) DEFAULT 0,
   130   is_regex tinyint(1) DEFAULT 0,
   131   reason text,
   131   reason text,
   132   PRIMARY KEY ( ban_id ) 
   132   PRIMARY KEY ( ban_id ) 
   133 ) CHARACTER SET `utf8`;
   133 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   134 
   134 
   135 CREATE TABLE {{TABLE_PREFIX}}files(
   135 CREATE TABLE {{TABLE_PREFIX}}files(
   136   file_id int(12) NOT NULL auto_increment,
   136   file_id int(12) NOT NULL auto_increment,
   137   time_id int(12) NOT NULL,
   137   time_id int(12) NOT NULL,
   138   page_id varchar(63) NOT NULL,
   138   page_id varchar(63) NOT NULL,
   140   size bigint(15) NOT NULL,
   140   size bigint(15) NOT NULL,
   141   mimetype varchar(63) default NULL,
   141   mimetype varchar(63) default NULL,
   142   file_extension varchar(8) default NULL,
   142   file_extension varchar(8) default NULL,
   143   file_key varchar(32) NOT NULL,
   143   file_key varchar(32) NOT NULL,
   144   PRIMARY KEY (file_id) 
   144   PRIMARY KEY (file_id) 
   145 ) CHARACTER SET `utf8`;
   145 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   146 
   146 
   147 CREATE TABLE {{TABLE_PREFIX}}buddies(
   147 CREATE TABLE {{TABLE_PREFIX}}buddies(
   148   buddy_id int(15) NOT NULL auto_increment,
   148   buddy_id int(15) NOT NULL auto_increment,
   149   user_id mediumint(8),
   149   user_id mediumint(8),
   150   buddy_user_id mediumint(8),
   150   buddy_user_id mediumint(8),
   151   is_friend tinyint(1) NOT NULL default '1',
   151   is_friend tinyint(1) NOT NULL default '1',
   152   PRIMARY KEY  (buddy_id) 
   152   PRIMARY KEY  (buddy_id) 
   153 ) CHARACTER SET `utf8`;
   153 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   154 
   154 
   155 CREATE TABLE {{TABLE_PREFIX}}privmsgs(
   155 CREATE TABLE {{TABLE_PREFIX}}privmsgs(
   156   message_id int(15) NOT NULL auto_increment,
   156   message_id int(15) NOT NULL auto_increment,
   157   message_from varchar(63),
   157   message_from varchar(63),
   158   message_to varchar(255),
   158   message_to varchar(255),
   160   subject varchar(63),
   160   subject varchar(63),
   161   message_text text,
   161   message_text text,
   162   folder_name varchar(63),
   162   folder_name varchar(63),
   163   message_read tinyint(1) NOT NULL DEFAULT 0,
   163   message_read tinyint(1) NOT NULL DEFAULT 0,
   164   PRIMARY KEY  (message_id) 
   164   PRIMARY KEY  (message_id) 
   165 ) CHARACTER SET `utf8`;
   165 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   166 
   166 
   167 CREATE TABLE {{TABLE_PREFIX}}sidebar(
   167 CREATE TABLE {{TABLE_PREFIX}}sidebar(
   168   item_id smallint(3) NOT NULL auto_increment,
   168   item_id smallint(3) NOT NULL auto_increment,
   169   item_order smallint(3) NOT NULL DEFAULT 0,
   169   item_order smallint(3) NOT NULL DEFAULT 0,
   170   item_enabled tinyint(1) NOT NULL DEFAULT 1,
   170   item_enabled tinyint(1) NOT NULL DEFAULT 1,
   171   sidebar_id smallint(3) NOT NULL DEFAULT 1,
   171   sidebar_id smallint(3) NOT NULL DEFAULT 1,
   172   block_name varchar(63) NOT NULL,
   172   block_name varchar(63) NOT NULL,
   173   block_type tinyint(1) NOT NULL DEFAULT 0,
   173   block_type tinyint(1) NOT NULL DEFAULT 0,
   174   block_content text,
   174   block_content text,
   175   PRIMARY KEY ( item_id )
   175   PRIMARY KEY ( item_id )
   176 ) CHARACTER SET `utf8`;
   176 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   177 
   177 
   178 CREATE TABLE {{TABLE_PREFIX}}hits(
   178 CREATE TABLE {{TABLE_PREFIX}}hits(
   179   hit_id bigint(20) NOT NULL auto_increment,
   179   hit_id bigint(20) NOT NULL auto_increment,
   180   username varchar(63) NOT NULL,
   180   username varchar(63) NOT NULL,
   181   time int(12) NOT NULL DEFAULT 0,
   181   time int(12) NOT NULL DEFAULT 0,
   182   page_id varchar(63),
   182   page_id varchar(63),
   183   namespace varchar(63),
   183   namespace varchar(63),
   184   PRIMARY KEY ( hit_id ) 
   184   PRIMARY KEY ( hit_id ) 
   185 ) CHARACTER SET `utf8`;
   185 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   186 
   186 
   187 CREATE TABLE {{TABLE_PREFIX}}search_index(
   187 CREATE TABLE {{TABLE_PREFIX}}search_index(
   188   word varbinary(64) NOT NULL,
   188   word varchar(64) NOT NULL,
   189   page_names text,
   189   page_names text,
   190   PRIMARY KEY ( word ) 
   190   PRIMARY KEY ( word ) 
   191 ) CHARACTER SET `utf8`;
   191 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   192 
   192 
   193 CREATE TABLE {{TABLE_PREFIX}}groups(
   193 CREATE TABLE {{TABLE_PREFIX}}groups(
   194   group_id mediumint(5) UNSIGNED NOT NULL auto_increment,
   194   group_id mediumint(5) UNSIGNED NOT NULL auto_increment,
   195   group_name varchar(64),
   195   group_name varchar(64),
   196   group_type tinyint(1) NOT NULL DEFAULT 1,
   196   group_type tinyint(1) NOT NULL DEFAULT 1,
   197   PRIMARY KEY ( group_id ),
   197   PRIMARY KEY ( group_id ),
   198   system_group tinyint(1) NOT NULL DEFAULT 0 
   198   system_group tinyint(1) NOT NULL DEFAULT 0 
   199 ) CHARACTER SET `utf8`;
   199 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   200 
   200 
   201 CREATE TABLE {{TABLE_PREFIX}}group_members(
   201 CREATE TABLE {{TABLE_PREFIX}}group_members(
   202   member_id int(12) UNSIGNED NOT NULL auto_increment,
   202   member_id int(12) UNSIGNED NOT NULL auto_increment,
   203   group_id mediumint(5) UNSIGNED NOT NULL,
   203   group_id mediumint(5) UNSIGNED NOT NULL,
   204   user_id int(12) NOT NULL,
   204   user_id int(12) NOT NULL,
   205   is_mod tinyint(1) NOT NULL DEFAULT 0,
   205   is_mod tinyint(1) NOT NULL DEFAULT 0,
   206   pending tinyint(1) NOT NULL DEFAULT 0,
   206   pending tinyint(1) NOT NULL DEFAULT 0,
   207   PRIMARY KEY ( member_id ) 
   207   PRIMARY KEY ( member_id ) 
   208 ) CHARACTER SET `utf8`;
   208 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   209 
   209 
   210 CREATE TABLE {{TABLE_PREFIX}}acl(
   210 CREATE TABLE {{TABLE_PREFIX}}acl(
   211   rule_id int(12) UNSIGNED NOT NULL auto_increment,
   211   rule_id int(12) UNSIGNED NOT NULL auto_increment,
   212   target_type tinyint(1) UNSIGNED NOT NULL,
   212   target_type tinyint(1) UNSIGNED NOT NULL,
   213   target_id int(12) UNSIGNED NOT NULL,
   213   target_id int(12) UNSIGNED NOT NULL,
   214   page_id varchar(255),
   214   page_id varchar(255),
   215   namespace varchar(24),
   215   namespace varchar(24),
   216   rules text,
   216   rules text,
   217   PRIMARY KEY ( rule_id ) 
   217   PRIMARY KEY ( rule_id ) 
   218 ) CHARACTER SET `utf8`;
   218 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   219 
       
   220 CREATE TABLE {{TABLE_PREFIX}}search_cache(
       
   221   search_id int(15) NOT NULL auto_increment,
       
   222   search_time int(11) NOT NULL,
       
   223   query text,
       
   224   results longblob,
       
   225   PRIMARY KEY ( search_id )
       
   226 ) CHARACTER SET `utf8`;
       
   227 
   219 
   228 -- Added in 1.0.1
   220 -- Added in 1.0.1
   229 
   221 
   230 CREATE TABLE {{TABLE_PREFIX}}page_groups(
   222 CREATE TABLE {{TABLE_PREFIX}}page_groups(
   231   pg_id mediumint(8) NOT NULL auto_increment,
   223   pg_id mediumint(8) NOT NULL auto_increment,
   232   pg_type tinyint(2) NOT NULL DEFAULT 1,
   224   pg_type tinyint(2) NOT NULL DEFAULT 1,
   233   pg_name varchar(255) NOT NULL DEFAULT '',
   225   pg_name varchar(255) NOT NULL DEFAULT '',
   234   pg_target varchar(255) DEFAULT NULL,
   226   pg_target varchar(255) DEFAULT NULL,
   235   PRIMARY KEY ( pg_id )
   227   PRIMARY KEY ( pg_id )
   236 ) CHARACTER SET `utf8`;
   228 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   237 
   229 
   238 -- Added in 1.0.1
   230 -- Added in 1.0.1
   239 
   231 
   240 CREATE TABLE {{TABLE_PREFIX}}page_group_members(
   232 CREATE TABLE {{TABLE_PREFIX}}page_group_members(
   241   pg_member_id int(12) NOT NULL auto_increment,
   233   pg_member_id int(12) NOT NULL auto_increment,
   242   pg_id mediumint(8) NOT NULL,
   234   pg_id mediumint(8) NOT NULL,
   243   page_id varchar(63) NOT NULL,
   235   page_id varchar(63) NOT NULL,
   244   namespace varchar(63) NOT NULL DEFAULT 'Article',
   236   namespace varchar(63) NOT NULL DEFAULT 'Article',
   245   PRIMARY KEY ( pg_member_id )
   237   PRIMARY KEY ( pg_member_id )
   246 ) CHARACTER SET `utf8`;
   238 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   247 
   239 
   248 -- Added in 1.0.1
   240 -- Added in 1.0.1
   249 
   241 
   250 CREATE TABLE {{TABLE_PREFIX}}tags(
   242 CREATE TABLE {{TABLE_PREFIX}}tags(
   251   tag_id int(12) NOT NULL auto_increment,
   243   tag_id int(12) NOT NULL auto_increment,
   252   tag_name varchar(63) NOT NULL DEFAULT 'bla',
   244   tag_name varchar(63) NOT NULL DEFAULT 'bla',
   253   page_id varchar(255) NOT NULL,
   245   page_id varchar(255) NOT NULL,
   254   namespace varchar(255) NOT NULL,
   246   namespace varchar(255) NOT NULL,
   255   user mediumint(8) NOT NULL DEFAULT 1,
   247   user mediumint(8) NOT NULL DEFAULT 1,
   256   PRIMARY KEY ( tag_id )
   248   PRIMARY KEY ( tag_id )
   257 ) CHARACTER SET `utf8`;
   249 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   258 
   250 
   259 -- Added in 1.1.1
   251 -- Added in 1.1.1
   260 
   252 
   261 CREATE TABLE {{TABLE_PREFIX}}lockout(
   253 CREATE TABLE {{TABLE_PREFIX}}lockout(
   262   id int(12) NOT NULL auto_increment,
   254   id int(12) NOT NULL auto_increment,