schema.sql
changeset 409 267be9e394c2
parent 408 7ecbe721217c
child 410 9db359d6e60c
equal deleted inserted replaced
408:7ecbe721217c 409:267be9e394c2
     1 -- Enano - an open-source CMS capable of wiki functions, Drupal-like sidebar blocks, and everything in between
       
     2 -- Version 1.0.2 (Coblynau)
       
     3 -- Copyright (C) 2006-2007 Dan Fuhry
       
     4 
       
     5 -- This program is Free Software; you can redistribute and/or modify it under the terms of the GNU General Public License
       
     6 -- as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
       
     7 
       
     8 -- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
       
     9 -- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
       
    10 
       
    11 -- schema.sql - MySQL installation schema. Firebird version in development.
       
    12 
       
    13 CREATE TABLE {{TABLE_PREFIX}}categories(
       
    14   page_id varchar(64),
       
    15   namespace varchar(64),
       
    16   category_id varchar(64)
       
    17 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
    18 
       
    19 CREATE TABLE {{TABLE_PREFIX}}comments(
       
    20   comment_id int(12) NOT NULL auto_increment,
       
    21   page_id text,
       
    22   namespace text,
       
    23   subject text,
       
    24   comment_data text,
       
    25   name text,
       
    26   approved tinyint(1) default 1,
       
    27   user_id mediumint(8) NOT NULL DEFAULT -1,
       
    28   time int(12) NOT NULL DEFAULT 0,
       
    29   PRIMARY KEY ( comment_id )
       
    30 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
    31 
       
    32 CREATE TABLE {{TABLE_PREFIX}}config(
       
    33   config_name varchar(63),
       
    34   config_value text
       
    35 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
    36 
       
    37 CREATE TABLE {{TABLE_PREFIX}}logs(
       
    38   log_type varchar(16),
       
    39   action varchar(16),
       
    40   time_id int(12) NOT NULL default '0',
       
    41   date_string varchar(63),
       
    42   page_id text,
       
    43   namespace text,
       
    44   page_text text,
       
    45   char_tag varchar(40),
       
    46   author varchar(63),
       
    47   edit_summary text,
       
    48   minor_edit tinyint(1)
       
    49 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
    50 
       
    51 CREATE TABLE {{TABLE_PREFIX}}page_text(
       
    52   page_id varchar(255),
       
    53   namespace varchar(16) NOT NULL default 'Article',
       
    54   page_text text,
       
    55   char_tag varchar(63),
       
    56   FULLTEXT KEY {{TABLE_PREFIX}}page_search_idx (page_id, namespace, page_text)
       
    57 ) ENGINE = MYISAM CHARACTER SET `utf8`;
       
    58 
       
    59 CREATE TABLE {{TABLE_PREFIX}}pages(
       
    60   page_order int(8),
       
    61   name varchar(255),
       
    62   urlname varchar(255),
       
    63   namespace varchar(16) NOT NULL default 'Article',
       
    64   special tinyint(1) default '0',
       
    65   visible tinyint(1) default '1',
       
    66   comments_on tinyint(1) default '1',
       
    67   protected tinyint(1) NOT NULL DEFAULT 0,
       
    68   wiki_mode tinyint(1) NOT NULL DEFAULT 2,
       
    69   delvotes int(10) NOT NULL default 0,
       
    70   password varchar(40) NOT NULL DEFAULT '',
       
    71   delvote_ips text DEFAULT NULL
       
    72 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
    73 
       
    74 CREATE TABLE {{TABLE_PREFIX}}session_keys(
       
    75   session_key varchar(32),
       
    76   salt varchar(32),
       
    77   user_id mediumint(8),
       
    78   auth_level tinyint(1) NOT NULL default '0',
       
    79   source_ip varchar(10) default '0x7f000001',
       
    80   time bigint(15) default '0'
       
    81 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
    82 
       
    83 CREATE TABLE {{TABLE_PREFIX}}themes(
       
    84   theme_id varchar(63),
       
    85   theme_name text,
       
    86   theme_order smallint(5) NOT NULL default '1',
       
    87   default_style varchar(63) NOT NULL DEFAULT '',
       
    88   enabled tinyint(1) NOT NULL default '1'
       
    89 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
    90 
       
    91 CREATE TABLE {{TABLE_PREFIX}}users(
       
    92   user_id mediumint(8) NOT NULL auto_increment,
       
    93   username text,
       
    94   password varchar(255),
       
    95   email text,
       
    96   real_name text,
       
    97   user_level tinyint(1) NOT NULL default 2,
       
    98   theme varchar(64) NOT NULL default 'bleu.css',
       
    99   style varchar(64) NOT NULL default 'default',
       
   100   signature text,
       
   101   reg_time int(11) NOT NULL DEFAULT 0,
       
   102   account_active tinyint(1) NOT NULL DEFAULT 0,
       
   103   activation_key varchar(40) NOT NULL DEFAULT 0,
       
   104   old_encryption tinyint(1) NOT NULL DEFAULT 0,
       
   105   temp_password text,
       
   106   temp_password_time int(12) NOT NULL DEFAULT 0,
       
   107   user_coppa tinyint(1) NOT NULL DEFAULT 0,
       
   108   user_lang smallint(5) NOT NULL,
       
   109   user_has_avatar tinyint(1) NOT NULL,
       
   110   avatar_type ENUM('jpg', 'png', 'gif') NOT NULL,
       
   111   PRIMARY KEY  (user_id)
       
   112 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   113 
       
   114 CREATE TABLE {{TABLE_PREFIX}}users_extra(
       
   115   user_id mediumint(8) NOT NULL,
       
   116   user_aim varchar(63),
       
   117   user_yahoo varchar(63),
       
   118   user_msn varchar(255),
       
   119   user_xmpp varchar(255),
       
   120   user_homepage text,
       
   121   user_location text,
       
   122   user_job text,
       
   123   user_hobbies text,
       
   124   email_public tinyint(1) NOT NULL DEFAULT 0,
       
   125   PRIMARY KEY ( user_id ) 
       
   126 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   127 
       
   128 CREATE TABLE {{TABLE_PREFIX}}banlist(
       
   129   ban_id mediumint(8) NOT NULL auto_increment,
       
   130   ban_type tinyint(1),
       
   131   ban_value varchar(64),
       
   132   is_regex tinyint(1) DEFAULT 0,
       
   133   reason text,
       
   134   PRIMARY KEY ( ban_id ) 
       
   135 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   136 
       
   137 CREATE TABLE {{TABLE_PREFIX}}files(
       
   138   file_id int(12) NOT NULL auto_increment,
       
   139   time_id int(12) NOT NULL,
       
   140   page_id varchar(63) NOT NULL,
       
   141   filename varchar(127) default NULL,
       
   142   size bigint(15) NOT NULL,
       
   143   mimetype varchar(63) default NULL,
       
   144   file_extension varchar(8) default NULL,
       
   145   file_key varchar(32) NOT NULL,
       
   146   PRIMARY KEY (file_id) 
       
   147 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   148 
       
   149 CREATE TABLE {{TABLE_PREFIX}}buddies(
       
   150   buddy_id int(15) NOT NULL auto_increment,
       
   151   user_id mediumint(8),
       
   152   buddy_user_id mediumint(8),
       
   153   is_friend tinyint(1) NOT NULL default '1',
       
   154   PRIMARY KEY  (buddy_id) 
       
   155 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   156 
       
   157 CREATE TABLE {{TABLE_PREFIX}}privmsgs(
       
   158   message_id int(15) NOT NULL auto_increment,
       
   159   message_from varchar(63),
       
   160   message_to varchar(255),
       
   161   date int(12),
       
   162   subject varchar(63),
       
   163   message_text text,
       
   164   folder_name varchar(63),
       
   165   message_read tinyint(1) NOT NULL DEFAULT 0,
       
   166   PRIMARY KEY  (message_id) 
       
   167 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   168 
       
   169 CREATE TABLE {{TABLE_PREFIX}}sidebar(
       
   170   item_id smallint(3) NOT NULL auto_increment,
       
   171   item_order smallint(3) NOT NULL DEFAULT 0,
       
   172   item_enabled tinyint(1) NOT NULL DEFAULT 1,
       
   173   sidebar_id smallint(3) NOT NULL DEFAULT 1,
       
   174   block_name varchar(63) NOT NULL,
       
   175   block_type tinyint(1) NOT NULL DEFAULT 0,
       
   176   block_content text,
       
   177   PRIMARY KEY ( item_id )
       
   178 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   179 
       
   180 CREATE TABLE {{TABLE_PREFIX}}hits(
       
   181   hit_id bigint(20) NOT NULL auto_increment,
       
   182   username varchar(63) NOT NULL,
       
   183   time int(12) NOT NULL DEFAULT 0,
       
   184   page_id varchar(63),
       
   185   namespace varchar(63),
       
   186   PRIMARY KEY ( hit_id ) 
       
   187 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   188 
       
   189 CREATE TABLE {{TABLE_PREFIX}}search_index(
       
   190   word varchar(64) NOT NULL,
       
   191   page_names text,
       
   192   PRIMARY KEY ( word ) 
       
   193 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   194 
       
   195 CREATE TABLE {{TABLE_PREFIX}}groups(
       
   196   group_id mediumint(5) UNSIGNED NOT NULL auto_increment,
       
   197   group_name varchar(64),
       
   198   group_type tinyint(1) NOT NULL DEFAULT 1,
       
   199   PRIMARY KEY ( group_id ),
       
   200   system_group tinyint(1) NOT NULL DEFAULT 0 
       
   201 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   202 
       
   203 CREATE TABLE {{TABLE_PREFIX}}group_members(
       
   204   member_id int(12) UNSIGNED NOT NULL auto_increment,
       
   205   group_id mediumint(5) UNSIGNED NOT NULL,
       
   206   user_id int(12) NOT NULL,
       
   207   is_mod tinyint(1) NOT NULL DEFAULT 0,
       
   208   pending tinyint(1) NOT NULL DEFAULT 0,
       
   209   PRIMARY KEY ( member_id ) 
       
   210 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   211 
       
   212 CREATE TABLE {{TABLE_PREFIX}}acl(
       
   213   rule_id int(12) UNSIGNED NOT NULL auto_increment,
       
   214   target_type tinyint(1) UNSIGNED NOT NULL,
       
   215   target_id int(12) UNSIGNED NOT NULL,
       
   216   page_id varchar(255),
       
   217   namespace varchar(24),
       
   218   rules text,
       
   219   PRIMARY KEY ( rule_id ) 
       
   220 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   221 
       
   222 -- Added in 1.0.1
       
   223 
       
   224 CREATE TABLE {{TABLE_PREFIX}}page_groups(
       
   225   pg_id mediumint(8) NOT NULL auto_increment,
       
   226   pg_type tinyint(2) NOT NULL DEFAULT 1,
       
   227   pg_name varchar(255) NOT NULL DEFAULT '',
       
   228   pg_target varchar(255) DEFAULT NULL,
       
   229   PRIMARY KEY ( pg_id )
       
   230 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   231 
       
   232 -- Added in 1.0.1
       
   233 
       
   234 CREATE TABLE {{TABLE_PREFIX}}page_group_members(
       
   235   pg_member_id int(12) NOT NULL auto_increment,
       
   236   pg_id mediumint(8) NOT NULL,
       
   237   page_id varchar(63) NOT NULL,
       
   238   namespace varchar(63) NOT NULL DEFAULT 'Article',
       
   239   PRIMARY KEY ( pg_member_id )
       
   240 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   241 
       
   242 -- Added in 1.0.1
       
   243 
       
   244 CREATE TABLE {{TABLE_PREFIX}}tags(
       
   245   tag_id int(12) NOT NULL auto_increment,
       
   246   tag_name varchar(63) NOT NULL DEFAULT 'bla',
       
   247   page_id varchar(255) NOT NULL,
       
   248   namespace varchar(255) NOT NULL,
       
   249   user mediumint(8) NOT NULL DEFAULT 1,
       
   250   PRIMARY KEY ( tag_id )
       
   251 ) CHARACTER SET `utf8` COLLATE `utf8_bin`;
       
   252 
       
   253 -- Added in 1.1.1
       
   254 
       
   255 CREATE TABLE {{TABLE_PREFIX}}lockout(
       
   256   id int(12) NOT NULL auto_increment,
       
   257   ipaddr varchar(40) NOT NULL,
       
   258   action ENUM('credential', 'level') NOT NULL DEFAULT 'credential',
       
   259   timestamp int(12) NOT NULL DEFAULT 0,
       
   260   PRIMARY KEY ( id )
       
   261 ) CHARACTER SET `utf8`;
       
   262 
       
   263 -- Added in 1.1.1
       
   264 
       
   265 CREATE TABLE {{TABLE_PREFIX}}language(
       
   266   lang_id smallint(5) NOT NULL auto_increment,
       
   267   lang_code varchar(16) NOT NULL,
       
   268   lang_name_default varchar(64) NOT NULL,
       
   269   lang_name_native varchar(64) NOT NULL,
       
   270   last_changed int(12) NOT NULL DEFAULT 0,
       
   271   PRIMARY KEY ( lang_id )
       
   272 ) CHARACTER SET `utf8`;
       
   273 
       
   274 -- Added in 1.1.1
       
   275 
       
   276 CREATE TABLE {{TABLE_PREFIX}}language_strings(
       
   277   string_id bigint(15) NOT NULL auto_increment,
       
   278   lang_id smallint(5) NOT NULL,
       
   279   string_category varchar(32) NOT NULL,
       
   280   string_name varchar(64) NOT NULL,
       
   281   string_content longtext NOT NULL,
       
   282   PRIMARY KEY ( string_id )
       
   283 );
       
   284 
       
   285 INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES
       
   286   ('site_name', '{{SITE_NAME}}'),
       
   287   ('main_page', 'Main_Page'),
       
   288   ('site_desc', '{{SITE_DESC}}'),
       
   289   ('wiki_mode', '{{WIKI_MODE}}'),
       
   290   ('wiki_edit_notice', '0'),
       
   291   ('sflogo_enabled', '0'),
       
   292   ('sflogo_groupid', ''),
       
   293   ('sflogo_type', '1'),
       
   294   ('w3c_vh32', '0'),
       
   295   ('w3c_vh40', '0'),
       
   296   ('w3c_vh401', '0'),
       
   297   ('w3c_vxhtml10', '0'),
       
   298   ('w3c_vxhtml11', '0'),
       
   299   ('w3c_vcss', '0'),
       
   300   ('approve_comments', '0'),
       
   301   ('enable_comments', '1'),
       
   302   ('plugin_SpecialAdmin.php', '1'),
       
   303   ('plugin_SpecialPageFuncs.php', '1'),
       
   304   ('plugin_SpecialUserFuncs.php', '1'),
       
   305   ('plugin_SpecialCSS.php', '1'),
       
   306   ('copyright_notice', '{{COPYRIGHT}}'),
       
   307   ('wiki_edit_notice_text', '== Why can I edit this page? ==\n\nEveryone can edit almost any page in this website. This concept is called a wiki. It gives everyone the opportunity to make a change for the best. While some spam and vandalism may occur, it is believed that most contributions will be legitimate and helpful.\n\nFor security purposes, a history of all page edits is kept, and administrators are able to restore vandalized or spammed pages with just a few clicks.'),
       
   308   ('cache_thumbs', '{{ENABLE_CACHE}}'),
       
   309   ('max_file_size', '256000'),('enano_version', '{{VERSION}}'),( 'allowed_mime_types', 'cbf:len=185;crc=55fb6f14;data=0[1],1[4],0[3],1[1],0[22],1[1],0[16],1[3],0[16],1[1],0[1],1[2],0[6],1[1],0[1],1[1],0[4],1[2],0[3],1[1],0[48],1[2],0[2],1[1],0[4],1[1],0[37]|end' ),
       
   310   ('contact_email', '{{ADMIN_EMAIL}}'),
       
   311   ('powered_btn', '1');
       
   312 
       
   313 INSERT INTO {{TABLE_PREFIX}}page_text(page_id, namespace, page_text, char_tag) VALUES
       
   314   ('Main_Page', 'Article', '=== Enano has been successfully installed and is working. ===\n\nIf you can see this message, it means that you\'ve finished the Enano setup process and are ready to start building your website. Congratulations!\n\nTo edit this front page, click the Log In button to the left, enter the credentials you provided during the installation, and click the Edit This Page button that appears on the blue toolbar just above this text. You can also [http://docs.enanocms.org/Help:2.4 learn more] about editing pages.\n\nTo create more pages, use the Create a Page button to the left. If you enabled wiki mode, you don\'t have to log in first, however your IP address will be shown in the page history.\n\nVisit the [http://docs.enanocms.org/Help:Contents Enano documentation project website] to learn more about administering your site effectively and keeping things secure.\n\n\'\'\'NOTE:\'\'\' You\'ve just installed an unstable version of Enano. This release is completely unsupported and may contain security issues or serious usability bugs. You should not use this release on a production website. The Enano team will not provide any type of support at all for this experimental release.', '');
       
   315 
       
   316 INSERT INTO {{TABLE_PREFIX}}pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES
       
   317   (NULL, 'Main Page', 'Main_Page', 'Article', 0, 1, 1, 1, 0, '');
       
   318 
       
   319 INSERT INTO {{TABLE_PREFIX}}themes(theme_id, theme_name, theme_order, default_style, enabled) VALUES
       
   320   ('oxygen', 'Oxygen', 1, 'bleu.css', 1),
       
   321   ('stpatty', 'St. Patty', 2, 'shamrock.css', 1);
       
   322 
       
   323 INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, signature, reg_time, account_active) VALUES
       
   324   (1, 'Anonymous', 'invalid-pass-hash', 'anonspam@enanocms.org', 'None', 1, 'oxygen', 'bleu', '', 0, 0),
       
   325   (2, '{{ADMIN_USER}}', '{{ADMIN_PASS}}', '{{ADMIN_EMAIL}}', '{{REAL_NAME}}', 9, 'oxygen', 'bleu', '', UNIX_TIMESTAMP(), 1);
       
   326   
       
   327 INSERT INTO {{TABLE_PREFIX}}users_extra(user_id) VALUES
       
   328   (2);
       
   329 
       
   330 INSERT INTO {{TABLE_PREFIX}}groups(group_id,group_name,group_type,system_group) VALUES(1, 'Everyone', 3, 1),
       
   331   (2,'Administrators',3,1),
       
   332   (3,'Moderators',3,1);
       
   333 
       
   334 INSERT INTO {{TABLE_PREFIX}}group_members(group_id,user_id,is_mod) VALUES(2, 2, 1);
       
   335 
       
   336 INSERT INTO {{TABLE_PREFIX}}acl(target_type,target_id,page_id,namespace,rules) VALUES
       
   337   (1,2,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=4;clear_logs=4;vote_delete=4;vote_reset=4;delete_page=4;tag_create=4;tag_delete_own=4;tag_delete_other=4;set_wiki_mode=4;password_set=4;password_reset=4;mod_misc=4;edit_cat=4;even_when_protected=4;upload_files=4;upload_new_version=4;create_page=4;php_in_pages={{ADMIN_EMBED_PHP}};edit_acl=4;'),
       
   338   (1,3,NULL,NULL,'read=4;post_comments=4;edit_comments=4;edit_page=4;view_source=4;mod_comments=4;history_view=4;history_rollback=4;history_rollback_extra=4;protect=4;rename=3;clear_logs=2;vote_delete=4;vote_reset=4;delete_page=4;set_wiki_mode=2;password_set=2;password_reset=2;mod_misc=2;edit_cat=4;even_when_protected=4;upload_files=2;upload_new_version=3;create_page=3;php_in_pages=2;edit_acl=2;');
       
   339 
       
   340 INSERT INTO {{TABLE_PREFIX}}sidebar(item_id, item_order, sidebar_id, block_name, block_type, block_content) VALUES
       
   341   (1, 1, 1, '{lang:sidebar_title_navigation}', 1, '[[Main_Page|{lang:sidebar_btn_home}]]'),
       
   342   (2, 2, 1, '{lang:sidebar_title_tools}', 1, '[[$NS_SPECIAL$CreatePage|{lang:sidebar_btn_createpage}]]\n[[$NS_SPECIAL$UploadFile|{lang:sidebar_btn_uploadfile}]]\n[[$NS_SPECIAL$SpecialPages|{lang:sidebar_btn_specialpages}]]\n{if auth_admin}\n$ADMIN_LINK$\n[[$NS_SPECIAL$EditSidebar|{lang:sidebar_btn_editsidebar}]]\n{/if}'),
       
   343   (3, 3, 1, '$USERNAME$', 1, '[[$NS_USER$$USERNAME$|{lang:sidebar_btn_userpage}]]\n[[$NS_SPECIAL$Contributions/$USERNAME$|{lang:sidebar_btn_mycontribs}]]\n{if user_logged_in}\n[[$NS_SPECIAL$Preferences|{lang:sidebar_btn_preferences}]]\n[[$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n[[$NS_SPECIAL$Usergroups|{lang:sidebar_btn_groupcp}]]\n$THEME_LINK$\n{/if}\n{if user_logged_in}\n$LOGOUT_LINK$\n{else}\n[[$NS_SPECIAL$Register|{lang:sidebar_btn_register}]]\n$LOGIN_LINK$\n[[$NS_SPECIAL$Login/$NS_SPECIAL$PrivateMessages|{lang:sidebar_btn_privatemessages}]]\n{/if}'),
       
   344   (4, 4, 1, '{lang:sidebar_title_search}', 1, '<div class="slideblock2" style="padding: 0px;"><form action="$CONTENTPATH$$NS_SPECIAL$Search" method="get" style="padding: 0; margin: 0;"><p><input type="hidden" name="title" value="$NS_SPECIAL$Search" />$INPUT_AUTH$<input name="q" alt="Search box" type="text" size="10" style="width: 70%" /> <input type="submit" value="{lang:sidebar_btn_search_go}" style="width: 20%" /></p></form></div>'),
       
   345   (5, 2, 2, '{lang:sidebar_title_links}', 4, 'Links');
       
   346