install/schemas/postgresql_stage2.sql
changeset 413 6607cd646d6d
parent 410 9db359d6e60c
child 430 ec90736b9cb9
equal deleted inserted replaced
412:4746dd07cc48 413:6607cd646d6d
    21   page_id text,
    21   page_id text,
    22   namespace text,
    22   namespace text,
    23   subject text,
    23   subject text,
    24   comment_data text,
    24   comment_data text,
    25   name text,
    25   name text,
    26   approved smallint default 1,
    26   approved smallint DEFAULT 1,
    27   user_id int NOT NULL DEFAULT -1,
    27   user_id int NOT NULL DEFAULT -1,
    28   time int NOT NULL DEFAULT 0,
    28   time int NOT NULL DEFAULT 0,
    29   ip_address varchar(39),
    29   ip_address varchar(39),
    30   PRIMARY KEY ( comment_id )
    30   PRIMARY KEY ( comment_id )
    31 );
    31 );
    32 
    32 
    33 CREATE TABLE {{TABLE_PREFIX}}logs(
    33 CREATE TABLE {{TABLE_PREFIX}}logs(
    34   log_id SERIAL,
    34   log_id SERIAL,
    35   log_type varchar(16),
    35   log_type varchar(16),
    36   action varchar(16),
    36   action varchar(16),
    37   time_id int NOT NULL default '0',
    37   time_id int NOT NULL DEFAULT '0',
    38   date_string varchar(63),
    38   date_string varchar(63),
    39   page_id text,
    39   page_id text,
    40   namespace text,
    40   namespace text,
    41   page_text text,
    41   page_text text,
    42   char_tag varchar(40),
    42   char_tag varchar(40),
    43   author varchar(63),
    43   author varchar(63),
    44   edit_summary text,
    44   edit_summary text,
    45   minor_edit smallint,
    45   minor_edit smallint,
       
    46   is_draft smallint NOT NULL DEFAULT 0,
    46   PRIMARY KEY ( log_id )
    47   PRIMARY KEY ( log_id )
    47 );
    48 );
    48 
    49 
    49 CREATE TABLE {{TABLE_PREFIX}}page_text(
    50 CREATE TABLE {{TABLE_PREFIX}}page_text(
    50   page_id varchar(255),
    51   page_id varchar(255),
    51   namespace varchar(16) NOT NULL default 'Article',
    52   namespace varchar(16) NOT NULL DEFAULT 'Article',
    52   page_text text,
    53   page_text text,
    53   char_tag varchar(63)
    54   char_tag varchar(63)
    54 );
    55 );
    55 
    56 
    56 CREATE TABLE {{TABLE_PREFIX}}pages(
    57 CREATE TABLE {{TABLE_PREFIX}}pages(
    57   page_order int,
    58   page_order int,
    58   name varchar(255),
    59   name varchar(255),
    59   urlname varchar(255),
    60   urlname varchar(255),
    60   namespace varchar(16) NOT NULL default 'Article',
    61   namespace varchar(16) NOT NULL DEFAULT 'Article',
    61   special smallint default '0',
    62   special smallint DEFAULT '0',
    62   visible smallint default '1',
    63   visible smallint DEFAULT '1',
    63   comments_on smallint default '1',
    64   comments_on smallint DEFAULT '1',
    64   protected smallint NOT NULL DEFAULT 0,
    65   protected smallint NOT NULL DEFAULT 0,
    65   wiki_mode smallint NOT NULL DEFAULT 2,
    66   wiki_mode smallint NOT NULL DEFAULT 2,
    66   delvotes int NOT NULL default 0,
    67   delvotes int NOT NULL DEFAULT 0,
    67   password varchar(40) NOT NULL DEFAULT '',
    68   password varchar(40) NOT NULL DEFAULT '',
    68   delvote_ips text DEFAULT NULL
    69   delvote_ips text DEFAULT NULL
    69 );
    70 );
    70 
    71 
    71 CREATE TABLE {{TABLE_PREFIX}}session_keys(
    72 CREATE TABLE {{TABLE_PREFIX}}session_keys(
    72   session_key varchar(32),
    73   session_key varchar(32),
    73   salt varchar(32),
    74   salt varchar(32),
    74   user_id int,
    75   user_id int,
    75   auth_level smallint NOT NULL default '0',
    76   auth_level smallint NOT NULL DEFAULT '0',
    76   source_ip varchar(10) default '0x7f000001',
    77   source_ip varchar(10) DEFAULT '0x7f000001',
    77   time bigint default '0'
    78   time bigint DEFAULT '0'
    78 );
    79 );
    79 
    80 
    80 CREATE TABLE {{TABLE_PREFIX}}themes(
    81 CREATE TABLE {{TABLE_PREFIX}}themes(
    81   theme_id varchar(63),
    82   theme_id varchar(63),
    82   theme_name text,
    83   theme_name text,
    83   theme_order smallint NOT NULL default '1',
    84   theme_order smallint NOT NULL DEFAULT '1',
    84   default_style varchar(63) NOT NULL DEFAULT '',
    85   DEFAULT_style varchar(63) NOT NULL DEFAULT '',
    85   enabled smallint NOT NULL default '1'
    86   enabled smallint NOT NULL DEFAULT '1'
    86 );
    87 );
    87 
    88 
    88 CREATE TABLE {{TABLE_PREFIX}}users(
    89 CREATE TABLE {{TABLE_PREFIX}}users(
    89   user_id SERIAL,
    90   user_id SERIAL,
    90   username text,
    91   username text,
    91   password varchar(255),
    92   password varchar(255),
    92   email text,
    93   email text,
    93   real_name text,
    94   real_name text,
    94   user_level smallint NOT NULL default 2,
    95   user_level smallint NOT NULL DEFAULT 2,
    95   theme varchar(64) NOT NULL default 'bleu.css',
    96   theme varchar(64) NOT NULL DEFAULT 'bleu.css',
    96   style varchar(64) NOT NULL default 'default',
    97   style varchar(64) NOT NULL DEFAULT 'DEFAULT',
    97   signature text,
    98   signature text,
    98   reg_time int NOT NULL DEFAULT 0,
    99   reg_time int NOT NULL DEFAULT 0,
    99   account_active smallint NOT NULL DEFAULT 0,
   100   account_active smallint NOT NULL DEFAULT 0,
   100   activation_key varchar(40) NOT NULL DEFAULT 0,
   101   activation_key varchar(40) NOT NULL DEFAULT 0,
   101   old_encryption smallint NOT NULL DEFAULT 0,
   102   old_encryption smallint NOT NULL DEFAULT 0,
   137 
   138 
   138 CREATE TABLE {{TABLE_PREFIX}}files(
   139 CREATE TABLE {{TABLE_PREFIX}}files(
   139   file_id SERIAL,
   140   file_id SERIAL,
   140   time_id int NOT NULL,
   141   time_id int NOT NULL,
   141   page_id varchar(63) NOT NULL,
   142   page_id varchar(63) NOT NULL,
   142   filename varchar(127) default NULL,
   143   filename varchar(127) DEFAULT NULL,
   143   size bigint NOT NULL,
   144   size bigint NOT NULL,
   144   mimetype varchar(63) default NULL,
   145   mimetype varchar(63) DEFAULT NULL,
   145   file_extension varchar(8) default NULL,
   146   file_extension varchar(8) DEFAULT NULL,
   146   file_key varchar(32) NOT NULL,
   147   file_key varchar(32) NOT NULL,
   147   PRIMARY KEY (file_id) 
   148   PRIMARY KEY (file_id) 
   148 );
   149 );
   149 
   150 
   150 CREATE TABLE {{TABLE_PREFIX}}buddies(
   151 CREATE TABLE {{TABLE_PREFIX}}buddies(
   151   buddy_id SERIAL,
   152   buddy_id SERIAL,
   152   user_id int,
   153   user_id int,
   153   buddy_user_id int,
   154   buddy_user_id int,
   154   is_friend smallint NOT NULL default '1',
   155   is_friend smallint NOT NULL DEFAULT '1',
   155   PRIMARY KEY  (buddy_id) 
   156   PRIMARY KEY  (buddy_id) 
   156 );
   157 );
   157 
   158 
   158 CREATE TABLE {{TABLE_PREFIX}}privmsgs(
   159 CREATE TABLE {{TABLE_PREFIX}}privmsgs(
   159   message_id SERIAL,
   160   message_id SERIAL,
   264 -- Added in 1.1.1
   265 -- Added in 1.1.1
   265 
   266 
   266 CREATE TABLE {{TABLE_PREFIX}}language(
   267 CREATE TABLE {{TABLE_PREFIX}}language(
   267   lang_id SERIAL,
   268   lang_id SERIAL,
   268   lang_code varchar(16) NOT NULL,
   269   lang_code varchar(16) NOT NULL,
   269   lang_name_default varchar(64) NOT NULL,
   270   lang_name_DEFAULT varchar(64) NOT NULL,
   270   lang_name_native varchar(64) NOT NULL,
   271   lang_name_native varchar(64) NOT NULL,
   271   last_changed int NOT NULL DEFAULT 0
   272   last_changed int NOT NULL DEFAULT 0
   272 );
   273 );
   273 
   274 
   274 -- Added in 1.1.1
   275 -- Added in 1.1.1
   335   ({{UNIX_TIME}}, 'DEPRECATED', 'page', 'edit', 'Main_Page', 'Article', '{{ADMIN_USER}}', '{{MAIN_PAGE_CONTENT}}');
   336   ({{UNIX_TIME}}, 'DEPRECATED', 'page', 'edit', 'Main_Page', 'Article', '{{ADMIN_USER}}', '{{MAIN_PAGE_CONTENT}}');
   336 
   337 
   337 INSERT INTO {{TABLE_PREFIX}}pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES
   338 INSERT INTO {{TABLE_PREFIX}}pages(page_order, name, urlname, namespace, special, visible, comments_on, protected, delvotes, delvote_ips) VALUES
   338   (NULL, 'Main Page', 'Main_Page', 'Article', 0, 1, 1, 1, 0, '');
   339   (NULL, 'Main Page', 'Main_Page', 'Article', 0, 1, 1, 1, 0, '');
   339 
   340 
   340 INSERT INTO {{TABLE_PREFIX}}themes(theme_id, theme_name, theme_order, default_style, enabled) VALUES
   341 INSERT INTO {{TABLE_PREFIX}}themes(theme_id, theme_name, theme_order, DEFAULT_style, enabled) VALUES
   341   ('oxygen', 'Oxygen', 1, 'bleu.css', 1),
   342   ('oxygen', 'Oxygen', 1, 'bleu.css', 1),
   342   ('stpatty', 'St. Patty', 2, 'shamrock.css', 1);
   343   ('stpatty', 'St. Patty', 2, 'shamrock.css', 1);
   343 
   344 
   344 INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, signature, reg_time, account_active, user_registration_ip, user_lang, user_has_avatar, avatar_type) VALUES
   345 INSERT INTO {{TABLE_PREFIX}}users(user_id, username, password, email, real_name, user_level, theme, style, signature, reg_time, account_active, user_registration_ip, user_lang, user_has_avatar, avatar_type) VALUES
   345   (1, 'Anonymous', 'invalid-pass-hash', 'anonspam@enanocms.org', 'None', 1, 'oxygen', 'bleu', '', 0, 0, '', 0, 0, 'png'),
   346   (1, 'Anonymous', 'invalid-pass-hash', 'anonspam@enanocms.org', 'None', 1, 'oxygen', 'bleu', '', 0, 0, '', 0, 0, 'png'),