Quick hacky script to initialize site_stats row where missing.
[lhc/web/wiklou.git] / maintenance / tables.sql
index c03a3b8..4f9a26f 100644 (file)
@@ -135,14 +135,14 @@ CREATE TABLE /*$wgDBprefix*/user_groups (
   KEY (ug_group)
 ) TYPE=InnoDB;
 
--- The following table is no longer needed with Enotif >= 2.00
--- Entries for newtalk on user_talk page are handled like in the watchlist table
--- CREATE TABLE /*$wgDBprefix*/user_newtalk (
---  user_id int(5) NOT NULL default '0',
---  user_ip varchar(40) NOT NULL default '',
---  INDEX user_id (user_id),
---  INDEX user_ip (user_ip)
--- );
+-- Stores notifications of user talk page changes, for the display
+-- of the "you have new messages" box
+CREATE TABLE /*$wgDBprefix*/user_newtalk (
+ user_id int(5) NOT NULL default '0',
+ user_ip varchar(40) NOT NULL default '',
+ INDEX user_id (user_id),
+ INDEX user_ip (user_ip)
+);
 
 
 --
@@ -269,7 +269,7 @@ CREATE TABLE /*$wgDBprefix*/text (
   
   -- Depending on the contents of the old_flags field, the text
   -- may be convenient plain text, or it may be funkily encoded.
-  old_text mediumtext NOT NULL default '',
+  old_text mediumblob NOT NULL default '',
   
   -- Comma-separated list of flags:
   -- gzip: text is compressed with PHP's gzdeflate() function.
@@ -301,7 +301,8 @@ CREATE TABLE /*$wgDBprefix*/archive (
   -- This field is retained for backwards compatibility,
   -- so old archived pages will remain accessible after
   -- upgrading from 1.4 to 1.5.
-  ar_text mediumtext NOT NULL default '',
+  -- Text may be gzipped or otherwise funky.
+  ar_text mediumblob NOT NULL default '',
   
   -- Basic revision stuff...
   ar_comment tinyblob NOT NULL default '',
@@ -437,6 +438,15 @@ CREATE TABLE /*$wgDBprefix*/site_stats (
   -- See isCountable() in includes/Article.php
   ss_good_articles bigint(20) unsigned default '0',
   
+  -- Total pages, theoretically equal to SELECT COUNT(*) FROM page; except faster
+  ss_total_pages bigint(20) default '-1',
+
+  -- Number of users, theoretically equal to SELECT COUNT(*) FROM user;
+  ss_users bigint(20) default '-1',
+
+  -- Deprecated, no longer updated as of 1.5
+  ss_admins int(10) default '-1',
+
   UNIQUE KEY ss_row_id (ss_row_id)
 
 ) TYPE=InnoDB;
@@ -444,8 +454,8 @@ CREATE TABLE /*$wgDBprefix*/site_stats (
 --
 -- Stores an ID for every time any article is visited;
 -- depending on $wgHitcounterUpdateFreq, it is
--- periodically cleared and the cur_counter column
--- in the cur table updated for the all articles
+-- periodically cleared and the page_counter column
+-- in the page table updated for the all articles
 -- that have been visited.)
 --
 CREATE TABLE /*$wgDBprefix*/hitcounter (
@@ -652,8 +662,7 @@ CREATE TABLE /*$wgDBprefix*/watchlist (
   
   -- Timestamp when user was last sent a notification e-mail;
   -- cleared when the user visits the page.
-  -- FIXME: add proper null support etc
-  wl_notificationtimestamp varchar(14) binary NOT NULL default '0',
+  wl_notificationtimestamp varchar(14) binary,
   
   UNIQUE KEY (wl_user, wl_namespace, wl_title),
   KEY namespace_title (wl_namespace,wl_title)
@@ -726,6 +735,9 @@ CREATE TABLE /*$wgDBprefix*/interwiki (
   -- (used, for example, to detect redirect loops)
   iw_local BOOL NOT NULL,
   
+  -- Boolean value indicating whether interwiki transclusions are allowed.
+  iw_trans TINYINT(1) NOT NULL DEFAULT 0,
+  
   UNIQUE KEY iw_prefix (iw_prefix)
 
 ) TYPE=InnoDB;
@@ -762,13 +774,14 @@ CREATE TABLE /*$wgDBprefix*/objectcache (
 
 -- For article validation
 CREATE TABLE /*$wgDBprefix*/validate (
-  `val_user` int(11) NOT NULL default '0',
-  `val_page` int(11) unsigned NOT NULL default '0',
-  `val_revision` int(11) unsigned NOT NULL default '0',
-  `val_type` int(11) unsigned NOT NULL default '0',
-  `val_value` int(11) default '0',
-  `val_comment` varchar(255) NOT NULL default '',
-  KEY `val_user` (`val_user`,`val_revision`)
+  val_user int(11) NOT NULL default '0',
+  val_page int(11) unsigned NOT NULL default '0',
+  val_revision int(11) unsigned NOT NULL default '0',
+  val_type int(11) unsigned NOT NULL default '0',
+  val_value int(11) default '0',
+  val_comment varchar(255) NOT NULL default '',
+  val_ip varchar(20) NOT NULL default '',
+  KEY val_user (val_user,val_revision)
 ) TYPE=InnoDB;
 
 
@@ -815,3 +828,14 @@ CREATE TABLE /*$wgDBprefix*/logging (
 --  PRIMARY KEY  (gr_id)
 --
 --) TYPE=InnoDB;
+
+CREATE TABLE /*$wgDBprefix*/trackbacks (
+       tb_id           INTEGER AUTO_INCREMENT PRIMARY KEY,
+       tb_page         INTEGER REFERENCES page(page_id) ON DELETE CASCADE,
+       tb_title        VARCHAR(255) NOT NULL,
+       tb_url          VARCHAR(255) NOT NULL,
+       tb_ex           TEXT,
+       tb_name         VARCHAR(255),
+
+       INDEX (tb_page)
+);