Remove tables.

        Patch by kareila. 

diffs (268 lines):

diff -r 62338401f906 -r f869d77eb4b4 bin/upgrading/base-data.sql
--- a/bin/upgrading/base-data.sql       Sun Aug 09 08:38:05 2009 +0000
+++ b/bin/upgrading/base-data.sql       Sun Aug 09 09:05:46 2009 +0000
@@ -582,8 +582,6 @@ UPDATE ratelist SET des='Logged when a f
 UPDATE ratelist SET des='Logged when a forgotten password or username e-mail 
is requested' WHERE name='lostinfo';
 INSERT IGNORE INTO ratelist (des, name) VALUES ('Logged whenever user posts 
(to any journal)', 'post');
 UPDATE ratelist SET des='Logged whenever user posts (to any journal)' WHERE 
name='post';
-INSERT IGNORE INTO ratelist (des, name) VALUES ('Logged when a user registers 
a number for SMS', 'sms_register');
-UPDATE ratelist SET des='Logged when a user registers a number for SMS' WHERE 
name='sms_register';
 INSERT IGNORE INTO ratelist (des, name) VALUES ('Logged when a users sends a 
message via Tell A Friend', 'tellafriend');
 UPDATE ratelist SET des='Logged when a users sends a message via Tell A 
Friend' WHERE name='tellafriend';
 INSERT IGNORE INTO ratelist (des, name) VALUES ('Logged when a users sends a 
message to another user', 'usermessage');
@@ -793,7 +791,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores ESN journal subscriptions data. A flag on 
event target (a journal) is written here saying whether there are known 
listeners out there.', '0', 'off', NULL, 'has_subs');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores IP addresses for spam reports, 
temporarily, whether the journal in which the anonymous comment was posted in 
has enabled IP tracking or not. Used with the [dbtable[spamreports]] 
table.\n\r\nThe LJ::record_anon_comment_ip function gets the anonymous comment 
IP, and records it here.\r\n\r\nA maintenance task cleans out IPs after 5 days 
- so anonymous comments deleted after 5 days are fairly useless, and reports 
about them are quietly discarded by the comment deletion system.', '0', 'off', 
NULL, 'tempanonips');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores Jabber roster data.', '0', 'off', NULL, 
'jabroster');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores SMS errors if they exist.', '0', 'off', 
NULL, 'sms_msgerror');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores a log count of generic actions that have 
happened, like a post action (which calls LJ::note_recent_action()).\n\r\nA 
maintenance task moves these logged summaries from the various clusters to the 
global [dbtable[actionhistory]] table.', '0', 'off', NULL, 'recentactions');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores blobs (binary large objects) of on-disk 
data.\n\r\nBlob* files/classes for storing Blobs need to be added either to a 
local path or a remote Blob server (\"remote Blob server\" support has since 
been removed in favor of MogileFS).\r\n\r\nNotes: blobids aren\'t necessarily 
unique between domains; global userpicids may collide with the counter used for 
the rest. So, the type must be in the key. domain IDs are set up in 
ljconfig.pl.', '0', 'off', NULL, 'userblob');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores comments, such as OpenID comments, 
awaiting user approval.', '0', 'off', NULL, 'pendcomments');
@@ -813,7 +810,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores data on where users are active, for 
per-activity user cluster statistics.\n\r\nThe LJ::make_user_active function 
updates into this table, so long as it has not already been updated for the 
same user within the last hour. For sites not using memcached, the table is 
always updated. Please see also [dbtable[active_user]].', '0', 'off', NULL, 
'clustertrack2');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores data to give users access to view their 
logins in the past 30 days, if they\'re at all afraid that their account has 
been compromised.', '0', 'off', NULL, 'loginlog');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores general purpose status log data, such as 
when an entry is deleted or logging post-by-e-mail activity.\n\r\nThe initiator 
of the event is stored here so we can look back and say, for example: \"this 
person deleted the entry\". This works for communities and individual journals, 
and the actions are logged on the account that lost the entry.\r\n\r\nThe basic 
format is [ action, actiontarget ].', '0', 'off', NULL, 'userlog');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores log of SMS message data.', '0', 'off', 
NULL, 'sms_msg');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores metadata about all comments to journal 
entries. Indexes are all on this table.', '0', 'off', NULL, 'talk2');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores metadata about all journal entries. The 
actual content is stored in [dbtable[logtext2]].', '0', 'off', NULL, 'log2');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores metadata about all user-to-user messages. 
The actual content is stored in [dbtable[usermsgtext]].', '0', 'off', NULL, 
'usermsg');
@@ -828,12 +824,10 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores moderated community entry Storable 
objects (all props/options).', '0', 'off', NULL, 'modblob');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores moderated community entry summary 
information.', '0', 'off', NULL, 'modlog');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores references to where a user has posted 
comments. Used for comments ([dbtable[user]] left in other journals) counter on 
user profile page.', '0', 'off', NULL, 'talkleft');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores the acknowledgments received for a given 
message.', '0', 'off', NULL, 'sms_msgack');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores the actual text of comments to journal 
entries.', '0', 'off', NULL, 'talktext2');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores the actual text of journal entries. Data 
is compressed if $LJ::COMPRESS_TEXT site variable is on.', '0', 'off', NULL, 
'logtext2');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores the actual text of user-to-user 
messages.', '0', 'off', NULL, 'usermsgtext');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores the actual userpic blobs. Optionally a 
blob server can be used instead of storing them here in the database.', '0', 
'off', NULL, 'userpicblob2');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores the raw and decoded SMS text content.', 
'0', 'off', NULL, 'sms_msgtext');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores the special links (\"reluser 
relationships\") between accounts.\n\r\nRelationship type IDs are defined in 
the LJ::get_reluser_id function. A relationship \"typeid\" cannot be a single 
character. Please see also [dbtable[reluser]].', '0', 'off', NULL, 'reluser2');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores the summary counts for security on entry 
keywords (tags).', '0', 'off', NULL, 'logkwsum');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered. Stores unixtime of the user\'s next birthday. 
Used for sending out birthday notifications.', '0', 'off', NULL, 'birthdays');
@@ -861,7 +855,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered.', '0', 'off', NULL, 'ratelog');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered.', '0', 'off', NULL, 's2stylelayers2');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered.', '0', 'off', NULL, 'sessions_data');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered.', '0', 'off', NULL, 'sms_msgprop');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered.', '0', 'off', NULL, 'user_schools');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered.', '0', 'off', NULL, 'userbio');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Clustered.', '0', 'off', NULL, 'userblobcache');
@@ -903,7 +896,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping a userid to an external 
identity and its type.\n\r\nThis focuses on OpenID consumer support, and was 
introduced so infrastructure was in place to make it completely identity-system 
neutral rather than OpenID-specific.\r\n\r\nIn theory, eventually, this will 
allow people to log in with TypeKey, LID, etc.', '0', 'off', NULL, 
'identitymap');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping memories to keywords. 
Please see also [dbtable[memkeyword2]].', '0', 'off', NULL, 'memkeyword');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping pollid <=> journalid.', 
'0', 'off', NULL, 'pollowner');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping remote-party msg unique ids 
to our userid/msgid tuples; similar to [dbtable[smsusermap]].', '0', 'off', 
NULL, 'smsuniqmap');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping userid <=> user(name).', 
'0', 'off', NULL, 'useridmap');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping userpic [dbtable[keywords]] 
to [dbtable[userpic]]s. Please see also the clustered [dbtable[userpicmap2]] 
table, used from data version 7.', '0', 'off', NULL, 'userpicmap');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores data for mapping value of unique cookie <=> 
userid.', '0', 'off', NULL, 'uniqmap');
@@ -921,7 +913,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores list of ESN notification class types.', '0', 
'off', NULL, 'notifytypelist');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores list of different admin privileges that 
users can have.', '1', 'replace', NULL, 'priv_list');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores list of possible metadata for ESN 
subscriptions. Unlike most other *proplist tables, this one is auto-populated 
by the LiveJournal application.', '0', 'off', NULL, 'subsproplist');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores list of possible metadata for SMS messages. 
Unlike most other *proplist tables, this one is auto-populated by the 
LiveJournal application.', '0', 'off', NULL, 'sms_msgproplist');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores list of possible metadata for comments.', 
'1', 'replace', NULL, 'talkproplist');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores list of possible metadata for journal 
entries.', '1', 'replace', NULL, 'logproplist');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Global. Stores list of possible metadata for polls.', '0', 
'off', NULL, 'pollproplist2');
@@ -961,7 +952,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Historic. Global. Stores a user\'s posts on other clusters, 
when either 1) that user isn\'t clustered themselves yet, or 2) we\'re doing a 
mass conversion (moveucluster.pl) and don\'t want to look it up.\n\r\nA 
maintenance task (clean_caches) moves data from here to [dbtable[talkleft]] on 
clusters.', '0', 'off', NULL, 'talkleft_xfp');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Historic. Stored data for old \'1.0\' version of the 
Portal; used before the Portal was re-designed.', '0', 'off', NULL, 'portal');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Lookup table for states, countries, languages, etc...', 
'1', 'replace', NULL, 'codes');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Stores data for mapping of userid <=> (SMS) number.', '0', 
'off', NULL, 'smsusermap');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Stores data on valid invite codes and who has used them. 
The acctinvite table stores the data on why they were made.', '0', 'off', NULL, 
'acctcode');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Stores globally-unique itemid and talkid ID (entries and 
comments), for URL compatibility. These were used pre-clustering. The 
LJ::get_newids function uses this table to find out what journal an old global 
ID belongs to and maps it to its new ID.', '0', 'off', NULL, 'oldids');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, 
tablename) VALUES ('Stores metadata for entries users mark as \"Memories\". 
Please see also the clustered [dbtable[memorable2]] table.', '0', 'off', NULL, 
'memorable');
diff -r 62338401f906 -r f869d77eb4b4 bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl        Sun Aug 09 08:38:05 2009 +0000
+++ b/bin/upgrading/update-db-general.pl        Sun Aug 09 09:05:46 2009 +0000
@@ -999,6 +999,14 @@ register_tabledrop("dw_pp_details");
 register_tabledrop("dw_pp_details");
 register_tabledrop("dw_pp_log");
 register_tabledrop("dw_pp_notify_log");
+register_tabledrop("smsusermap");
+register_tabledrop("smsuniqmap");
+register_tabledrop("sms_msg");
+register_tabledrop("sms_msgack");
+register_tabledrop("sms_msgtext");
+register_tabledrop("sms_msgerror");
+register_tabledrop("sms_msgprop");
+register_tabledrop("sms_msgproplist");
 
 register_tablecreate("portal", <<'EOC');
 CREATE TABLE portal (
@@ -2262,100 +2270,6 @@ EOC
 EOC
 
 # global
-register_tablecreate("smsusermap", <<'EOC');
-CREATE TABLE smsusermap (
-    number     VARCHAR(25) NOT NULL PRIMARY KEY,
-    userid     INT UNSIGNED NOT NULL,
-
-    INDEX(userid)
-)
-EOC
-
-# global
-register_tablecreate("smsuniqmap", <<'EOC');
-CREATE TABLE smsuniqmap (
-    msg_uniq  VARCHAR(25) NOT NULL PRIMARY KEY,
-    userid    INT UNSIGNED NOT NULL,
-    msgid     MEDIUMINT UNSIGNED NOT NULL
-)
-EOC
-
-# clustered
-register_tablecreate("sms_msg", <<'EOC');
-CREATE TABLE sms_msg (
-    userid        INT UNSIGNED NOT NULL,
-    msgid         MEDIUMINT UNSIGNED NOT NULL,
-    timecreate    INT UNSIGNED NOT NULL,
-    type          ENUM('incoming', 'outgoing'),
-    from_number   VARCHAR(15),
-    to_number     VARCHAR(15),
-    msg_raw       BLOB NOT NULL,
-
-    PRIMARY KEY (userid, msgid)
-)
-EOC
-
-# clustered
-register_tablecreate("sms_msgack", <<'EOC');
-CREATE TABLE sms_msgack (
-    userid         INT UNSIGNED NOT NULL,
-    msgid          MEDIUMINT UNSIGNED NOT NULL,
-    type           ENUM('gateway', 'smsc', 'handset', 'unknown'),
-    timerecv       INT UNSIGNED NOT NULL,
-    status_flag    ENUM('success', 'error', 'unknown'),
-    status_code    VARCHAR(25),
-    status_text    VARCHAR(255) NOT NULL,
-
-    INDEX (userid, msgid)
-)
-EOC
-
-# clustered
-register_tablecreate("sms_msgtext", <<'EOC');
-CREATE TABLE sms_msgtext (
-    userid        INT UNSIGNED NOT NULL,
-    msgid         MEDIUMINT UNSIGNED NOT NULL,
-    msg_raw       BLOB NOT NULL,
-    msg_decoded   BLOB NOT NULL,
-
-    PRIMARY KEY (userid, msgid)
-)
-EOC
-
-# clustered
-register_tablecreate("sms_msgerror", <<'EOC');
-CREATE TABLE sms_msgerror (
-    userid        INT UNSIGNED NOT NULL,
-    msgid         MEDIUMINT UNSIGNED NOT NULL,
-    error         TEXT NOT NULL,
-
-    PRIMARY KEY (userid, msgid)
-)
-EOC
-
-# clustered
-register_tablecreate("sms_msgprop", <<'EOC');
-CREATE TABLE sms_msgprop (
-    userid        INT UNSIGNED NOT NULL,
-    msgid         MEDIUMINT UNSIGNED NOT NULL,
-    propid        SMALLINT UNSIGNED NOT NULL,
-    propval       VARCHAR(255) NOT NULL,
-
-    PRIMARY KEY (userid, msgid, propid)
-)
-EOC
-
-# unlike most other *proplist tables, this one is auto-populated by app
-register_tablecreate("sms_msgproplist", <<'EOC');
-CREATE TABLE sms_msgproplist (
-    propid  SMALLINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,
-    name    VARCHAR(255) DEFAULT NULL,
-
-    UNIQUE KEY (name)
-)
-EOC
-
-# global
 register_tablecreate("usertrans", <<'EOC');
 CREATE TABLE `usertrans` (
     `userid` int(10) unsigned NOT NULL default '0',
@@ -3749,21 +3663,6 @@ register_alter(sub {
                  "ALTER TABLE eventtypelist CHANGE eventtypeid etypeid 
SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT");
     }
 
-    unless (column_type("sms_msg", "status")) {
-        do_alter("sms_msg",
-                 "ALTER TABLE sms_msg ADD status ENUM('success', 'error', 
'unknown') NOT NULL DEFAULT 'unknown' AFTER type");
-    }
-
-    unless (column_type("sms_msg", "status") =~ /ack_wait/) {
-        do_alter("sms_msg",
-                 "ALTER TABLE sms_msg MODIFY status ENUM('success', 'error', 
'ack_wait', 'unknown') NOT NULL DEFAULT 'unknown'");
-    }
-
-    if (column_type("sms_msg", "msg_raw")) {
-        do_alter("sms_msg",
-                 "ALTER TABLE sms_msg DROP msg_raw");
-    }
-
     # add index on journalid, etypeid to subs
     unless (index_name("subs", "INDEX:etypeid-journalid") || 
index_name("subs", "INDEX:etypeid-journalid-userid")) {
         # This one is deprecated by the one below, which adds a userid
@@ -3778,53 +3677,6 @@ register_alter(sub {
 
     unless (column_type("sch_exitstatus", "funcid")) {
         do_alter("sch_exitstatus", "alter table sch_exitstatus add funcid INT 
UNSIGNED NOT NULL DEFAULT 0, add index (funcid)");
-    }
-
-    # make userid unique
-    if (index_name("smsusermap", "INDEX:userid")) {
-        # iterate over the table and delete dupes
-        my $sth = $dbh->prepare("SELECT userid, number FROM smsusermap");
-        $sth->execute();
-
-        my %map = ();
-        while (my $row = $sth->fetchrow_hashref) {
-            my $uid = $row->{userid};
-            my $num = $row->{number};
-
-            if ($map{$uid}) {
-                # dupe, delete
-                $dbh->do("DELETE FROM smsusermap WHERE userid=? AND number=?",
-                         undef, $uid, $num);
-            }
-
-            $map{$uid} = 1;
-        }
-
-        do_alter("smsusermap", "ALTER IGNORE TABLE smsusermap ".
-                 "DROP KEY userid, ADD UNIQUE (userid)");
-    }
-
-    # add index to sms_msg
-    unless (index_name("sms_msg", "INDEX:userid-timecreate")) {
-        do_alter("sms_msg", "ALTER TABLE sms_msg ADD INDEX(userid, 
timecreate)");
-    }
-
-    # add typekey to sms_msg
-    unless (column_type("sms_msg", "class_key")) {
-        do_alter("sms_msg", "ALTER TABLE sms_msg " .
-                 "ADD class_key VARCHAR(25) NOT NULL default 'unknown' AFTER 
timecreate");
-    }
-
-    # add index on just timecreate for time-bound stats
-    unless (index_name("sms_msg", "INDEX:timecreate")) {
-        do_alter("sms_msg", "ALTER TABLE sms_msg ADD INDEX(timecreate)");
-    }
-
-    # add verified/instime columns to smsusermap
-    unless (column_type("smsusermap", "verified")) {
-        do_alter("smsusermap", "ALTER TABLE smsusermap " .
-                 "ADD verified ENUM('Y','N') NOT NULL DEFAULT 'N', " .
-                 "ADD instime INT UNSIGNED NOT NULL");
     }
 
     # add an index
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to