Remove dangerous DROP statements from table creation. If accidentally
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 24 Mar 2004 07:52:25 +0000 (07:52 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 24 Mar 2004 07:52:25 +0000 (07:52 +0000)
overwriting an existing database this destroys all data without warning...
better to let it fail with an error message and let the rare cases where
this is intended be dealt with manually by dropping them yourself.

maintenance/tables.sql

index 96aa781..91df23e 100644 (file)
@@ -4,7 +4,6 @@
 --
 -- Indexes should be defined here; please import the rest from indexes.sql.
 
-DROP TABLE IF EXISTS user;
 CREATE TABLE user (
   user_id int(5) unsigned NOT NULL auto_increment,
   user_name varchar(255) binary NOT NULL default '',
@@ -17,13 +16,11 @@ CREATE TABLE user (
   UNIQUE KEY user_id (user_id)
 ) PACK_KEYS=1;
        
-DROP TABLE IF EXISTS user_newtalk;
 CREATE TABLE user_newtalk (
   user_id int(5) NOT NULL default '0',
   user_ip varchar(40) NOT NULL default ''
 );
 
-DROP TABLE IF EXISTS cur;
 CREATE TABLE cur (
   cur_id int(8) unsigned NOT NULL auto_increment,
   cur_namespace tinyint(2) unsigned NOT NULL default '0',
@@ -44,7 +41,6 @@ CREATE TABLE cur (
   UNIQUE KEY cur_id (cur_id)
 ) PACK_KEYS=1;
 
-DROP TABLE IF EXISTS old;
 CREATE TABLE old (
   old_id int(8) unsigned NOT NULL auto_increment,
   old_namespace tinyint(2) unsigned NOT NULL default '0',
@@ -60,7 +56,6 @@ CREATE TABLE old (
   UNIQUE KEY old_id (old_id)
 ) PACK_KEYS=1;
 
-DROP TABLE IF EXISTS archive;
 CREATE TABLE archive (
   ar_namespace tinyint(2) unsigned NOT NULL default '0',
   ar_title varchar(255) binary NOT NULL default '',
@@ -77,7 +72,6 @@ CREATE TABLE archive (
 -- Track links that do exist
 -- l_from and l_to key to cur_id
 --
-DROP TABLE IF EXISTS links;
 CREATE TABLE links (
   l_from int(8) unsigned NOT NULL default '0',
   l_to int(8) unsigned NOT NULL default '0',
@@ -90,7 +84,6 @@ CREATE TABLE links (
 -- bl_from keys to cur_id
 -- bl_to is a text link (namespace:title)
 --
-DROP TABLE IF EXISTS brokenlinks;
 CREATE TABLE brokenlinks (
   bl_from int(8) unsigned NOT NULL default '0',
   bl_to varchar(255) binary NOT NULL default '',
@@ -103,7 +96,6 @@ CREATE TABLE brokenlinks (
 -- il_from keys to cur_id, il_to keys to image_name.
 -- We don't distinguish live from broken links.
 --
-DROP TABLE IF EXISTS imagelinks;
 CREATE TABLE imagelinks (
   il_from int(8) unsigned NOT NULL default '0',
   il_to varchar(255) binary NOT NULL default '',
@@ -116,13 +108,11 @@ CREATE TABLE imagelinks (
 -- cache arrays to reduce database load slurping up
 -- from links and brokenlinks.
 --
-DROP TABLE IF EXISTS linkscc;
 CREATE TABLE linkscc (
   lcc_pageid INT UNSIGNED NOT NULL UNIQUE KEY,
   lcc_cacheobj MEDIUMBLOB NOT NULL
 );
 
-DROP TABLE IF EXISTS site_stats;
 CREATE TABLE site_stats (
   ss_row_id int(8) unsigned NOT NULL,
   ss_total_views bigint(20) unsigned default '0',
@@ -131,12 +121,10 @@ CREATE TABLE site_stats (
   UNIQUE KEY ss_row_id (ss_row_id)
 );
 
-DROP TABLE IF EXISTS hitcounter;
 CREATE TABLE hitcounter (
   hc_id INTEGER UNSIGNED NOT NULL
 ) TYPE=HEAP MAX_ROWS=25000;
 
-DROP TABLE IF EXISTS ipblocks;
 CREATE TABLE ipblocks (
   ipb_id int(8) NOT NULL auto_increment,
   ipb_address varchar(40) binary NOT NULL default '',
@@ -149,7 +137,6 @@ CREATE TABLE ipblocks (
   UNIQUE KEY ipb_id (ipb_id)
 ) PACK_KEYS=1;
 
-DROP TABLE IF EXISTS image;
 CREATE TABLE image (
   img_name varchar(255) binary NOT NULL default '',
   img_size int(8) unsigned NOT NULL default '0',
@@ -159,7 +146,6 @@ CREATE TABLE image (
   img_timestamp char(14) binary NOT NULL default ''
 ) PACK_KEYS=1;
 
-DROP TABLE IF EXISTS oldimage;
 CREATE TABLE oldimage (
   oi_name varchar(255) binary NOT NULL default '',
   oi_archive_name varchar(255) binary NOT NULL default '',
@@ -170,7 +156,6 @@ CREATE TABLE oldimage (
   oi_timestamp char(14) binary NOT NULL default ''
 ) PACK_KEYS=1;
 
-DROP TABLE IF EXISTS recentchanges;
 CREATE TABLE recentchanges (
   rc_timestamp varchar(14) binary NOT NULL default '',
   rc_cur_time varchar(14) binary NOT NULL default '',
@@ -190,7 +175,6 @@ CREATE TABLE recentchanges (
   rc_moved_to_title varchar(255) binary NOT NULL default ''
 ) PACK_KEYS=1;
 
-DROP TABLE IF EXISTS watchlist;
 CREATE TABLE watchlist (
   wl_user int(5) unsigned NOT NULL,
   wl_namespace tinyint(2) unsigned NOT NULL default '0',
@@ -198,7 +182,6 @@ CREATE TABLE watchlist (
   UNIQUE KEY (wl_user, wl_namespace, wl_title)
 ) PACK_KEYS=1;
 
-DROP TABLE IF EXISTS math;
 CREATE TABLE math (
   math_inputhash varchar(16) NOT NULL,
   math_outputhash varchar(16) NOT NULL,
@@ -211,7 +194,6 @@ CREATE TABLE math (
 
 -- Table searchindex must be MyISAM for fulltext support
 
-DROP TABLE IF EXISTS searchindex;
 CREATE TABLE searchindex (
   si_page int(8) unsigned NOT NULL,
   si_title varchar(255) NOT NULL default '',
@@ -219,7 +201,6 @@ CREATE TABLE searchindex (
   UNIQUE KEY (si_page)
 ) PACK_KEYS=1;
 
-DROP TABLE IF EXISTS interwiki;
 CREATE TABLE interwiki (
   iw_prefix char(32) NOT NULL,
   iw_url char(127) NOT NULL,