schema.sql
changeset 78 4df25dfdde63
parent 76 608dee512bf0
child 80 cb7dde69c301
equal deleted inserted replaced
77:63ca29eda873 78:4df25dfdde63
    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` COLLATE `utf8_bin`;
    17 ) CHARACTER SET `utf8`;
    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` COLLATE `utf8_bin`;
    30 ) CHARACTER SET `utf8`;
    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` COLLATE `utf8_bin`;
    35 ) CHARACTER SET `utf8`;
    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` COLLATE `utf8_bin`;
    49 ) CHARACTER SET `utf8`;
    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,
    55   char_tag varchar(63)
    55   char_tag varchar(63)
    56 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    56 ) CHARACTER SET `utf8`;
    57 
    57 
    58 CREATE TABLE {{TABLE_PREFIX}}pages(
    58 CREATE TABLE {{TABLE_PREFIX}}pages(
    59   page_order int(8),
    59   page_order int(8),
    60   name varchar(127),
    60   name varchar(127),
    61   urlname varchar(63),
    61   urlname varchar(63),
    66   protected tinyint(1) NOT NULL DEFAULT 0,
    66   protected tinyint(1) NOT NULL DEFAULT 0,
    67   wiki_mode tinyint(1) NOT NULL DEFAULT 2,
    67   wiki_mode tinyint(1) NOT NULL DEFAULT 2,
    68   delvotes int(10) NOT NULL default 0,
    68   delvotes int(10) NOT NULL default 0,
    69   password varchar(40) NOT NULL DEFAULT '',
    69   password varchar(40) NOT NULL DEFAULT '',
    70   delvote_ips text NOT NULL
    70   delvote_ips text NOT NULL
    71 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    71 ) CHARACTER SET `utf8`;
    72 
    72 
    73 CREATE TABLE {{TABLE_PREFIX}}session_keys(
    73 CREATE TABLE {{TABLE_PREFIX}}session_keys(
    74   session_key varchar(32),
    74   session_key varchar(32),
    75   salt varchar(32),
    75   salt varchar(32),
    76   user_id mediumint(8),
    76   user_id mediumint(8),
    77   auth_level tinyint(1) NOT NULL default '0',
    77   auth_level tinyint(1) NOT NULL default '0',
    78   source_ip varchar(10) default '0x7f000001',
    78   source_ip varchar(10) default '0x7f000001',
    79   time bigint(15) default '0'
    79   time bigint(15) default '0'
    80 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    80 ) CHARACTER SET `utf8`;
    81 
    81 
    82 CREATE TABLE {{TABLE_PREFIX}}themes(
    82 CREATE TABLE {{TABLE_PREFIX}}themes(
    83   theme_id varchar(63),
    83   theme_id varchar(63),
    84   theme_name text,
    84   theme_name text,
    85   theme_order smallint(5) NOT NULL default '1',
    85   theme_order smallint(5) NOT NULL default '1',
    86   default_style varchar(63) NOT NULL DEFAULT '',
    86   default_style varchar(63) NOT NULL DEFAULT '',
    87   enabled tinyint(1) NOT NULL default '1'
    87   enabled tinyint(1) NOT NULL default '1'
    88 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
    88 ) CHARACTER SET `utf8`;
    89 
    89 
    90 CREATE TABLE {{TABLE_PREFIX}}users(
    90 CREATE TABLE {{TABLE_PREFIX}}users(
    91   user_id mediumint(8) NOT NULL auto_increment,
    91   user_id mediumint(8) NOT NULL auto_increment,
    92   username text,
    92   username text,
    93   password varchar(255),
    93   password varchar(255),
   103   old_encryption tinyint(1) NOT NULL DEFAULT 0,
   103   old_encryption tinyint(1) NOT NULL DEFAULT 0,
   104   temp_password text,
   104   temp_password text,
   105   temp_password_time int(12) NOT NULL DEFAULT 0,
   105   temp_password_time int(12) NOT NULL DEFAULT 0,
   106   user_coppa tinyint(1) NOT NULL DEFAULT 0,
   106   user_coppa tinyint(1) NOT NULL DEFAULT 0,
   107   PRIMARY KEY  (user_id)
   107   PRIMARY KEY  (user_id)
   108 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   108 ) CHARACTER SET `utf8`;
   109 
   109 
   110 CREATE TABLE {{TABLE_PREFIX}}users_extra(
   110 CREATE TABLE {{TABLE_PREFIX}}users_extra(
   111   user_id mediumint(8) NOT NULL,
   111   user_id mediumint(8) NOT NULL,
   112   user_aim varchar(63),
   112   user_aim varchar(63),
   113   user_yahoo varchar(63),
   113   user_yahoo varchar(63),
   117   user_location text,
   117   user_location text,
   118   user_job text,
   118   user_job text,
   119   user_hobbies text,
   119   user_hobbies text,
   120   email_public tinyint(1) NOT NULL DEFAULT 0,
   120   email_public tinyint(1) NOT NULL DEFAULT 0,
   121   PRIMARY KEY ( user_id ) 
   121   PRIMARY KEY ( user_id ) 
   122 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   122 ) CHARACTER SET `utf8`;
   123 
   123 
   124 CREATE TABLE {{TABLE_PREFIX}}banlist(
   124 CREATE TABLE {{TABLE_PREFIX}}banlist(
   125   ban_id mediumint(8) NOT NULL auto_increment,
   125   ban_id mediumint(8) NOT NULL auto_increment,
   126   ban_type tinyint(1),
   126   ban_type tinyint(1),
   127   ban_value varchar(64),
   127   ban_value varchar(64),
   128   is_regex tinyint(1) DEFAULT 0,
   128   is_regex tinyint(1) DEFAULT 0,
   129   reason text,
   129   reason text,
   130   PRIMARY KEY ( ban_id ) 
   130   PRIMARY KEY ( ban_id ) 
   131 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   131 ) CHARACTER SET `utf8`;
   132 
   132 
   133 CREATE TABLE {{TABLE_PREFIX}}files(
   133 CREATE TABLE {{TABLE_PREFIX}}files(
   134   file_id int(12) NOT NULL auto_increment,
   134   file_id int(12) NOT NULL auto_increment,
   135   time_id int(12) NOT NULL,
   135   time_id int(12) NOT NULL,
   136   page_id varchar(63) NOT NULL,
   136   page_id varchar(63) NOT NULL,
   138   size bigint(15) NOT NULL,
   138   size bigint(15) NOT NULL,
   139   mimetype varchar(63) default NULL,
   139   mimetype varchar(63) default NULL,
   140   file_extension varchar(8) default NULL,
   140   file_extension varchar(8) default NULL,
   141   file_key varchar(32) NOT NULL,
   141   file_key varchar(32) NOT NULL,
   142   PRIMARY KEY (file_id) 
   142   PRIMARY KEY (file_id) 
   143 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   143 ) CHARACTER SET `utf8`;
   144 
   144 
   145 CREATE TABLE {{TABLE_PREFIX}}buddies(
   145 CREATE TABLE {{TABLE_PREFIX}}buddies(
   146   buddy_id int(15) NOT NULL auto_increment,
   146   buddy_id int(15) NOT NULL auto_increment,
   147   user_id mediumint(8),
   147   user_id mediumint(8),
   148   buddy_user_id mediumint(8),
   148   buddy_user_id mediumint(8),
   149   is_friend tinyint(1) NOT NULL default '1',
   149   is_friend tinyint(1) NOT NULL default '1',
   150   PRIMARY KEY  (buddy_id) 
   150   PRIMARY KEY  (buddy_id) 
   151 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   151 ) CHARACTER SET `utf8`;
   152 
   152 
   153 CREATE TABLE {{TABLE_PREFIX}}privmsgs(
   153 CREATE TABLE {{TABLE_PREFIX}}privmsgs(
   154   message_id int(15) NOT NULL auto_increment,
   154   message_id int(15) NOT NULL auto_increment,
   155   message_from varchar(63),
   155   message_from varchar(63),
   156   message_to varchar(255),
   156   message_to varchar(255),
   158   subject varchar(63),
   158   subject varchar(63),
   159   message_text text,
   159   message_text text,
   160   folder_name varchar(63),
   160   folder_name varchar(63),
   161   message_read tinyint(1) NOT NULL DEFAULT 0,
   161   message_read tinyint(1) NOT NULL DEFAULT 0,
   162   PRIMARY KEY  (message_id) 
   162   PRIMARY KEY  (message_id) 
   163 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   163 ) CHARACTER SET `utf8`;
   164 
   164 
   165 CREATE TABLE {{TABLE_PREFIX}}sidebar(
   165 CREATE TABLE {{TABLE_PREFIX}}sidebar(
   166   item_id smallint(3) NOT NULL auto_increment,
   166   item_id smallint(3) NOT NULL auto_increment,
   167   item_order smallint(3) NOT NULL DEFAULT 0,
   167   item_order smallint(3) NOT NULL DEFAULT 0,
   168   item_enabled tinyint(1) NOT NULL DEFAULT 1,
   168   item_enabled tinyint(1) NOT NULL DEFAULT 1,
   169   sidebar_id smallint(3) NOT NULL DEFAULT 1,
   169   sidebar_id smallint(3) NOT NULL DEFAULT 1,
   170   block_name varchar(63) NOT NULL,
   170   block_name varchar(63) NOT NULL,
   171   block_type tinyint(1) NOT NULL DEFAULT 0,
   171   block_type tinyint(1) NOT NULL DEFAULT 0,
   172   block_content text,
   172   block_content text,
   173   PRIMARY KEY ( item_id )
   173   PRIMARY KEY ( item_id )
   174 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   174 ) CHARACTER SET `utf8`;
   175 
   175 
   176 CREATE TABLE {{TABLE_PREFIX}}hits(
   176 CREATE TABLE {{TABLE_PREFIX}}hits(
   177   hit_id bigint(20) NOT NULL auto_increment,
   177   hit_id bigint(20) NOT NULL auto_increment,
   178   username varchar(63) NOT NULL,
   178   username varchar(63) NOT NULL,
   179   time int(12) NOT NULL DEFAULT 0,
   179   time int(12) NOT NULL DEFAULT 0,
   180   page_id varchar(63),
   180   page_id varchar(63),
   181   namespace varchar(63),
   181   namespace varchar(63),
   182   PRIMARY KEY ( hit_id ) 
   182   PRIMARY KEY ( hit_id ) 
   183 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   183 ) CHARACTER SET `utf8`;
   184 
   184 
   185 CREATE TABLE {{TABLE_PREFIX}}search_index(
   185 CREATE TABLE {{TABLE_PREFIX}}search_index(
   186   word varbinary(64) NOT NULL,
   186   word varbinary(64) NOT NULL,
   187   page_names text,
   187   page_names text,
   188   PRIMARY KEY ( word ) 
   188   PRIMARY KEY ( word ) 
   189 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   189 ) CHARACTER SET `utf8`;
   190 
   190 
   191 CREATE TABLE {{TABLE_PREFIX}}groups(
   191 CREATE TABLE {{TABLE_PREFIX}}groups(
   192   group_id mediumint(5) UNSIGNED NOT NULL auto_increment,
   192   group_id mediumint(5) UNSIGNED NOT NULL auto_increment,
   193   group_name varchar(64),
   193   group_name varchar(64),
   194   group_type tinyint(1) NOT NULL DEFAULT 1,
   194   group_type tinyint(1) NOT NULL DEFAULT 1,
   195   PRIMARY KEY ( group_id ),
   195   PRIMARY KEY ( group_id ),
   196   system_group tinyint(1) NOT NULL DEFAULT 0 
   196   system_group tinyint(1) NOT NULL DEFAULT 0 
   197 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   197 ) CHARACTER SET `utf8`;
   198 
   198 
   199 CREATE TABLE {{TABLE_PREFIX}}group_members(
   199 CREATE TABLE {{TABLE_PREFIX}}group_members(
   200   member_id int(12) UNSIGNED NOT NULL auto_increment,
   200   member_id int(12) UNSIGNED NOT NULL auto_increment,
   201   group_id mediumint(5) UNSIGNED NOT NULL,
   201   group_id mediumint(5) UNSIGNED NOT NULL,
   202   user_id int(12) NOT NULL,
   202   user_id int(12) NOT NULL,
   203   is_mod tinyint(1) NOT NULL DEFAULT 0,
   203   is_mod tinyint(1) NOT NULL DEFAULT 0,
   204   pending tinyint(1) NOT NULL DEFAULT 0,
   204   pending tinyint(1) NOT NULL DEFAULT 0,
   205   PRIMARY KEY ( member_id ) 
   205   PRIMARY KEY ( member_id ) 
   206 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   206 ) CHARACTER SET `utf8`;
   207 
   207 
   208 CREATE TABLE {{TABLE_PREFIX}}acl(
   208 CREATE TABLE {{TABLE_PREFIX}}acl(
   209   rule_id int(12) UNSIGNED NOT NULL auto_increment,
   209   rule_id int(12) UNSIGNED NOT NULL auto_increment,
   210   target_type tinyint(1) UNSIGNED NOT NULL,
   210   target_type tinyint(1) UNSIGNED NOT NULL,
   211   target_id int(12) UNSIGNED NOT NULL,
   211   target_id int(12) UNSIGNED NOT NULL,
   212   page_id varchar(255),
   212   page_id varchar(255),
   213   namespace varchar(24),
   213   namespace varchar(24),
   214   rules text,
   214   rules text,
   215   PRIMARY KEY ( rule_id ) 
   215   PRIMARY KEY ( rule_id ) 
   216 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   216 ) CHARACTER SET `utf8`;
   217 
   217 
   218 CREATE TABLE {{TABLE_PREFIX}}search_cache(
   218 CREATE TABLE {{TABLE_PREFIX}}search_cache(
   219   search_id int(15) NOT NULL auto_increment,
   219   search_id int(15) NOT NULL auto_increment,
   220   search_time int(11) NOT NULL,
   220   search_time int(11) NOT NULL,
   221   query text,
   221   query text,
   222   results longblob,
   222   results longblob,
   223   PRIMARY KEY ( search_id )
   223   PRIMARY KEY ( search_id )
   224 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   224 ) CHARACTER SET `utf8`;
   225 
   225 
   226 -- Added in 1.0.1
   226 -- Added in 1.0.1
   227 
   227 
   228 CREATE TABLE {{TABLE_PREFIX}}page_groups(
   228 CREATE TABLE {{TABLE_PREFIX}}page_groups(
   229   pg_id mediumint(8) NOT NULL auto_increment,
   229   pg_id mediumint(8) NOT NULL auto_increment,
   230   pg_type tinyint(2) NOT NULL DEFAULT 1,
   230   pg_type tinyint(2) NOT NULL DEFAULT 1,
   231   pg_name varchar(255) NOT NULL DEFAULT '',
   231   pg_name varchar(255) NOT NULL DEFAULT '',
   232   pg_target varchar(255) DEFAULT NULL,
   232   pg_target varchar(255) DEFAULT NULL,
   233   PRIMARY KEY ( pg_id )
   233   PRIMARY KEY ( pg_id )
   234 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   234 ) CHARACTER SET `utf8`;
   235 
   235 
   236 -- Added in 1.0.1
   236 -- Added in 1.0.1
   237 
   237 
   238 CREATE TABLE {{TABLE_PREFIX}}page_group_members(
   238 CREATE TABLE {{TABLE_PREFIX}}page_group_members(
   239   pg_member_id int(12) NOT NULL auto_increment,
   239   pg_member_id int(12) NOT NULL auto_increment,
   240   pg_id mediumint(8) NOT NULL,
   240   pg_id mediumint(8) NOT NULL,
   241   page_id varchar(63) NOT NULL,
   241   page_id varchar(63) NOT NULL,
   242   namespace varchar(63) NOT NULL DEFAULT 'Article',
   242   namespace varchar(63) NOT NULL DEFAULT 'Article',
   243   PRIMARY KEY ( pg_member_id )
   243   PRIMARY KEY ( pg_member_id )
   244 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   244 ) CHARACTER SET `utf8`;
   245 
   245 
   246 -- Added in 1.0.1
   246 -- Added in 1.0.1
   247 
   247 
   248 CREATE TABLE {{TABLE_PREFIX}}tags(
   248 CREATE TABLE {{TABLE_PREFIX}}tags(
   249   tag_id int(12) NOT NULL auto_increment,
   249   tag_id int(12) NOT NULL auto_increment,
   250   tag_name varchar(63) NOT NULL DEFAULT 'bla',
   250   tag_name varchar(63) NOT NULL DEFAULT 'bla',
   251   page_id varchar(255) NOT NULL,
   251   page_id varchar(255) NOT NULL,
   252   namespace varchar(255) NOT NULL,
   252   namespace varchar(255) NOT NULL,
   253   user mediumint(8) NOT NULL DEFAULT 1,
   253   user mediumint(8) NOT NULL DEFAULT 1,
   254   PRIMARY KEY ( tag_id )
   254   PRIMARY KEY ( tag_id )
   255 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
   255 ) CHARACTER SET `utf8`;
   256 
   256 
   257 INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES
   257 INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES
   258   ('site_name', '{{SITE_NAME}}'),
   258   ('site_name', '{{SITE_NAME}}'),
   259   ('main_page', 'Main_Page'),
   259   ('main_page', 'Main_Page'),
   260   ('site_desc', '{{SITE_DESC}}'),
   260   ('site_desc', '{{SITE_DESC}}'),