install/schemas/postgresql_stage2.sql
changeset 348 87e08a6e4fec
child 349 fdaf9070566c
equal deleted inserted replaced
347:299a90e28abc 348:87e08a6e4fec
       
     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 -- mysql_stage2.sql - MySQL installation schema, main payload
       
    12 
       
    13 CREATE TABLE {{TABLE_PREFIX}}categories(
       
    14   page_id varchar(64),
       
    15   namespace varchar(64),
       
    16   category_id varchar(64)
       
    17 );
       
    18 
       
    19 CREATE TABLE {{TABLE_PREFIX}}comments(
       
    20   comment_id SERIAL,
       
    21   page_id text,
       
    22   namespace text,
       
    23   subject text,
       
    24   comment_data text,
       
    25   name text,
       
    26   approved smallint default 1,
       
    27   user_id int NOT NULL DEFAULT -1,
       
    28   time int NOT NULL DEFAULT 0,
       
    29   PRIMARY KEY ( comment_id )
       
    30 );
       
    31 
       
    32 CREATE TABLE {{TABLE_PREFIX}}logs(
       
    33   log_type varchar(16),
       
    34   action varchar(16),
       
    35   time_id int NOT NULL default '0',
       
    36   date_string varchar(63),
       
    37   page_id text,
       
    38   namespace text,
       
    39   page_text text,
       
    40   char_tag varchar(40),
       
    41   author varchar(63),
       
    42   edit_summary text,
       
    43   minor_edit smallint
       
    44 );
       
    45 
       
    46 CREATE TABLE {{TABLE_PREFIX}}page_text(
       
    47   page_id varchar(255),
       
    48   namespace varchar(16) NOT NULL default 'Article',
       
    49   page_text text,
       
    50   char_tag varchar(63)
       
    51 );
       
    52 
       
    53 CREATE TABLE {{TABLE_PREFIX}}pages(
       
    54   page_order int,
       
    55   name varchar(255),
       
    56   urlname varchar(255),
       
    57   namespace varchar(16) NOT NULL default 'Article',
       
    58   special smallint default '0',
       
    59   visible smallint default '1',
       
    60   comments_on smallint default '1',
       
    61   protected smallint NOT NULL DEFAULT 0,
       
    62   wiki_mode smallint NOT NULL DEFAULT 2,
       
    63   delvotes int NOT NULL default 0,
       
    64   password varchar(40) NOT NULL DEFAULT '',
       
    65   delvote_ips text DEFAULT NULL
       
    66 );
       
    67 
       
    68 CREATE TABLE {{TABLE_PREFIX}}session_keys(
       
    69   session_key varchar(32),
       
    70   salt varchar(32),
       
    71   user_id int,
       
    72   auth_level smallint NOT NULL default '0',
       
    73   source_ip varchar(10) default '0x7f000001',
       
    74   time bigint default '0'
       
    75 );
       
    76 
       
    77 CREATE TABLE {{TABLE_PREFIX}}themes(
       
    78   theme_id varchar(63),
       
    79   theme_name text,
       
    80   theme_order smallint NOT NULL default '1',
       
    81   default_style varchar(63) NOT NULL DEFAULT '',
       
    82   enabled smallint NOT NULL default '1'
       
    83 );
       
    84 
       
    85 CREATE TABLE {{TABLE_PREFIX}}users(
       
    86   user_id SERIAL,
       
    87   username text,
       
    88   password varchar(255),
       
    89   email text,
       
    90   real_name text,
       
    91   user_level smallint NOT NULL default 2,
       
    92   theme varchar(64) NOT NULL default 'bleu.css',
       
    93   style varchar(64) NOT NULL default 'default',
       
    94   signature text,
       
    95   reg_time int NOT NULL DEFAULT 0,
       
    96   account_active smallint NOT NULL DEFAULT 0,
       
    97   activation_key varchar(40) NOT NULL DEFAULT 0,
       
    98   old_encryption smallint NOT NULL DEFAULT 0,
       
    99   temp_password text,
       
   100   temp_password_time int NOT NULL DEFAULT 0,
       
   101   user_coppa smallint NOT NULL DEFAULT 0,
       
   102   PRIMARY KEY  (user_id)
       
   103 );
       
   104 
       
   105 CREATE TABLE {{TABLE_PREFIX}}users_extra(
       
   106   user_id int NOT NULL,
       
   107   user_aim varchar(63),
       
   108   user_yahoo varchar(63),
       
   109   user_msn varchar(255),
       
   110   user_xmpp varchar(255),
       
   111   user_homepage text,
       
   112   user_location text,
       
   113   user_job text,
       
   114   user_hobbies text,
       
   115   email_public smallint NOT NULL DEFAULT 0,
       
   116   PRIMARY KEY ( user_id ) 
       
   117 );
       
   118 
       
   119 CREATE TABLE {{TABLE_PREFIX}}banlist(
       
   120   ban_id SERIAL,
       
   121   ban_type smallint,
       
   122   ban_value varchar(64),
       
   123   is_regex smallint DEFAULT 0,
       
   124   reason text,
       
   125   PRIMARY KEY ( ban_id ) 
       
   126 );
       
   127 
       
   128 CREATE TABLE {{TABLE_PREFIX}}files(
       
   129   file_id SERIAL,
       
   130   time_id int NOT NULL,
       
   131   page_id varchar(63) NOT NULL,
       
   132   filename varchar(127) default NULL,
       
   133   size bigint NOT NULL,
       
   134   mimetype varchar(63) default NULL,
       
   135   file_extension varchar(8) default NULL,
       
   136   file_key varchar(32) NOT NULL,
       
   137   PRIMARY KEY (file_id) 
       
   138 );
       
   139 
       
   140 CREATE TABLE {{TABLE_PREFIX}}buddies(
       
   141   buddy_id SERIAL,
       
   142   user_id int,
       
   143   buddy_user_id int,
       
   144   is_friend smallint NOT NULL default '1',
       
   145   PRIMARY KEY  (buddy_id) 
       
   146 );
       
   147 
       
   148 CREATE TABLE {{TABLE_PREFIX}}privmsgs(
       
   149   message_id SERIAL,
       
   150   message_from varchar(63),
       
   151   message_to varchar(255),
       
   152   date int,
       
   153   subject varchar(63),
       
   154   message_text text,
       
   155   folder_name varchar(63),
       
   156   message_read smallint NOT NULL DEFAULT 0,
       
   157   PRIMARY KEY  (message_id) 
       
   158 );
       
   159 
       
   160 CREATE TABLE {{TABLE_PREFIX}}sidebar(
       
   161   item_id SERIAL,
       
   162   item_order smallint NOT NULL DEFAULT 0,
       
   163   item_enabled smallint NOT NULL DEFAULT 1,
       
   164   sidebar_id smallint NOT NULL DEFAULT 1,
       
   165   block_name varchar(63) NOT NULL,
       
   166   block_type smallint NOT NULL DEFAULT 0,
       
   167   block_content text,
       
   168   PRIMARY KEY ( item_id )
       
   169 );
       
   170 
       
   171 CREATE TABLE {{TABLE_PREFIX}}hits(
       
   172   hit_id SERIAL,
       
   173   username varchar(63) NOT NULL,
       
   174   time int NOT NULL DEFAULT 0,
       
   175   page_id varchar(63),
       
   176   namespace varchar(63),
       
   177   PRIMARY KEY ( hit_id ) 
       
   178 );
       
   179 
       
   180 CREATE TABLE {{TABLE_PREFIX}}search_index(
       
   181   word varchar(64) NOT NULL,
       
   182   page_names text,
       
   183   PRIMARY KEY ( word ) 
       
   184 );
       
   185 
       
   186 CREATE TABLE {{TABLE_PREFIX}}groups(
       
   187   group_id SERIAL,
       
   188   group_name varchar(64),
       
   189   group_type smallint NOT NULL DEFAULT 1,
       
   190   PRIMARY KEY ( group_id ),
       
   191   system_group smallint NOT NULL DEFAULT 0 
       
   192 );
       
   193 
       
   194 CREATE TABLE {{TABLE_PREFIX}}group_members(
       
   195   member_id SERIAL,
       
   196   group_id int NOT NULL,
       
   197   user_id int NOT NULL,
       
   198   is_mod smallint NOT NULL DEFAULT 0,
       
   199   pending smallint NOT NULL DEFAULT 0,
       
   200   PRIMARY KEY ( member_id ) 
       
   201 );
       
   202 
       
   203 CREATE TABLE {{TABLE_PREFIX}}acl(
       
   204   rule_id SERIAL,
       
   205   target_type smallint NOT NULL,
       
   206   target_id int NOT NULL,
       
   207   page_id varchar(255),
       
   208   namespace varchar(24),
       
   209   rules text,
       
   210   PRIMARY KEY ( rule_id ) 
       
   211 );
       
   212 
       
   213 -- Added in 1.0.1
       
   214 
       
   215 CREATE TABLE {{TABLE_PREFIX}}page_groups(
       
   216   pg_id SERIAL,
       
   217   pg_type smallint NOT NULL DEFAULT 1,
       
   218   pg_name varchar(255) NOT NULL DEFAULT '',
       
   219   pg_target varchar(255) DEFAULT NULL,
       
   220   PRIMARY KEY ( pg_id )
       
   221 );
       
   222 
       
   223 -- Added in 1.0.1
       
   224 
       
   225 CREATE TABLE {{TABLE_PREFIX}}page_group_members(
       
   226   pg_member_id SERIAL,
       
   227   pg_id int NOT NULL,
       
   228   page_id varchar(63) NOT NULL,
       
   229   namespace varchar(63) NOT NULL DEFAULT 'Article',
       
   230   PRIMARY KEY ( pg_member_id )
       
   231 );
       
   232 
       
   233 -- Added in 1.0.1
       
   234 
       
   235 CREATE TABLE {{TABLE_PREFIX}}tags(
       
   236   tag_id SERIAL,
       
   237   tag_name varchar(63) NOT NULL DEFAULT 'bla',
       
   238   page_id varchar(255) NOT NULL,
       
   239   namespace varchar(255) NOT NULL,
       
   240   user_id int NOT NULL DEFAULT 1,
       
   241   PRIMARY KEY ( tag_id )
       
   242 );
       
   243 
       
   244 -- Added in 1.1.1
       
   245 
       
   246 CREATE TABLE {{TABLE_PREFIX}}lockout(
       
   247   id SERIAL,
       
   248   ipaddr varchar(40) NOT NULL,
       
   249   action varchar(20) NOT NULL DEFAULT 'credential',
       
   250   timestamp int NOT NULL DEFAULT 0,
       
   251   CHECK ( action IN ('credential', 'level') )
       
   252 );
       
   253 
       
   254 -- Added in 1.1.1
       
   255 
       
   256 CREATE TABLE {{TABLE_PREFIX}}language(
       
   257   lang_id SERIAL,
       
   258   lang_code varchar(16) NOT NULL,
       
   259   lang_name_default varchar(64) NOT NULL,
       
   260   lang_name_native varchar(64) NOT NULL,
       
   261   last_changed int NOT NULL DEFAULT 0
       
   262 );
       
   263 
       
   264 -- Added in 1.1.1
       
   265 
       
   266 CREATE TABLE {{TABLE_PREFIX}}language_strings(
       
   267   string_id SERIAL,
       
   268   lang_id int NOT NULL,
       
   269   string_category varchar(32) NOT NULL,
       
   270   string_name varchar(64) NOT NULL,
       
   271   string_content text NOT NULL
       
   272 );
       
   273 
       
   274 DELETE FROM {{TABLE_PREFIX}}config;
       
   275 
       
   276 INSERT INTO {{TABLE_PREFIX}}config(config_name, config_value) VALUES
       
   277   ('site_name', '{{SITE_NAME}}'),
       
   278   ('main_page', 'Main_Page'),
       
   279   ('site_desc', '{{SITE_DESC}}'),
       
   280   ('wiki_mode', '{{WIKI_MODE}}'),
       
   281   ('wiki_edit_notice', '0'),
       
   282   ('sflogo_enabled', '0'),
       
   283   ('sflogo_groupid', ''),
       
   284   ('sflogo_type', '1'),
       
   285   ('w3c_vh32', '0'),
       
   286   ('w3c_vh40', '0'),
       
   287   ('w3c_vh401', '0'),
       
   288   ('w3c_vxhtml10', '0'),
       
   289   ('w3c_vxhtml11', '0'),
       
   290   ('w3c_vcss', '0'),
       
   291   ('approve_comments', '0'),
       
   292   ('enable_comments', '1'),
       
   293   ('plugin_SpecialAdmin.php', '1'),
       
   294   ('plugin_SpecialPageFuncs.php', '1'),
       
   295   ('plugin_SpecialUserFuncs.php', '1'),
       
   296   ('plugin_SpecialCSS.php', '1'),
       
   297   ('copyright_notice', '{{COPYRIGHT}}'),
       
   298   ('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.'),
       
   299   ('cache_thumbs', '{{ENABLE_CACHE}}'),
       
   300   ('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' ),
       
   301   ('contact_email', '{{ADMIN_EMAIL}}'),
       
   302   ('powered_btn', '1');
       
   303 
       
   304 INSERT INTO {{TABLE_PREFIX}}page_text(page_id, namespace, page_text, char_tag) VALUES
       
   305   ('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.', '');
       
   306 
       
   307 INSERT INTO {{TABLE_PREFIX}}pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES
       
   308   (NULL, 'Main Page', 'Main_Page', 'Article', 0, 1, 1, 1, 0, '');
       
   309 
       
   310 INSERT INTO {{TABLE_PREFIX}}themes(theme_id, theme_name, theme_order, default_style, enabled) VALUES
       
   311   ('oxygen', 'Oxygen', 1, 'bleu.css', 1),
       
   312   ('stpatty', 'St. Patty', 2, 'shamrock.css', 1);
       
   313 
       
   314 INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, signature, reg_time, account_active) VALUES
       
   315   (1, 'Anonymous', 'invalid-pass-hash', 'anonspam@enanocms.org', 'None', 1, 'oxygen', 'bleu', '', 0, 0),
       
   316   (2, '{{ADMIN_USER}}', '{{ADMIN_PASS}}', '{{ADMIN_EMAIL}}', '{{REAL_NAME}}', 9, 'oxygen', 'bleu', '', {{UNIX_TIME}}, 1);
       
   317   
       
   318 INSERT INTO {{TABLE_PREFIX}}users_extra(user_id) VALUES
       
   319   (2);
       
   320 
       
   321 INSERT INTO {{TABLE_PREFIX}}groups(group_id,group_name,group_type,system_group) VALUES(1, 'Everyone', 3, 1),
       
   322   (2,'Administrators',3,1),
       
   323   (3,'Moderators',3,1);
       
   324 
       
   325 INSERT INTO {{TABLE_PREFIX}}group_members(group_id,user_id,is_mod) VALUES(2, 2, 1);
       
   326 
       
   327 INSERT INTO {{TABLE_PREFIX}}acl(target_type,target_id,page_id,namespace,rules) VALUES
       
   328   (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;'),
       
   329   (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;');
       
   330 
       
   331 INSERT INTO {{TABLE_PREFIX}}sidebar(item_id, item_order, sidebar_id, block_name, block_type, block_content) VALUES
       
   332   (1, 1, 1, '{lang:sidebar_title_navigation}', 1, '[[Main_Page|{lang:sidebar_btn_home}]]'),
       
   333   (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}'),
       
   334   (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}'),
       
   335   (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>'),
       
   336   (5, 2, 2, '{lang:sidebar_title_links}', 4, 'Links');
       
   337