Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DB MIGRATION REQ'D] Add first_seen to follows table
* Will enable future 'new follows' data listings
- Loading branch information
1 parent
ba1bca6
commit b1c59ea
Showing
3 changed files
with
41 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
webapp/install/sql/mysql_migrations/2011-08-30_add_first_seen_to_followers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-- Add first_seen field to tu_follows | ||
-- While we're in there, comment all the fields of the new table | ||
|
||
CREATE TABLE tu_follows_b15 ( | ||
user_id bigint(11) NOT NULL COMMENT 'User ID on a particular service who has been followed.', | ||
follower_id bigint(11) NOT NULL COMMENT 'User ID on a particular service who has followed user_id.', | ||
last_seen timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Last time this relationship was seen on the originating network.', | ||
first_seen timestamp NOT NULL COMMENT 'First time this relationship was seen on the originating network.', | ||
active int(11) NOT NULL DEFAULT '1' COMMENT 'Whether or not the relationship is active (1 if so, 0 if not.)', | ||
network varchar(20) NOT NULL DEFAULT 'twitter' COMMENT 'Originating network in lower case, i.e., twitter or facebook.', | ||
debug_api_call varchar(255) NOT NULL COMMENT 'Developer-only field for storing the API URL source of this data point.', | ||
UNIQUE KEY user_id (network,follower_id,user_id), | ||
KEY active (network,active,last_seen), | ||
KEY network (network,last_seen) | ||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Service user follow and friend relationships.'; | ||
|
||
INSERT INTO tu_follows_b15 (SELECT user_id, follower_id, last_seen, last_seen, active, network, debug_api_call FROM tu_follows); | ||
|
||
RENAME TABLE tu_follows TO tu_follows_b14; | ||
|
||
RENAME TABLE tu_follows_b15 TO tu_follows; | ||
|
||
DROP TABLE tu_follows_b14; | ||
|