Advertisement
Guest User

Untitled

a guest
Nov 9th, 2010
1,174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 3.49 KB | None | 0 0
  1. CREATE TABLE log (
  2.   log_id int(10) unsigned NOT NULL AUTO_INCREMENT,
  3.   user_id int(10) unsigned NOT NULL,
  4.   log_ip varchar(15) NOT NULL,
  5.   log_error_text text NOT NULL,
  6.   log_occured_on datetime NOT NULL,
  7.   PRIMARY KEY (log_id),
  8.   KEY user_id (user_id),
  9.   KEY log_occured_on (log_occured_on)
  10. ) TYPE=InnoDB  AUTO_INCREMENT=2 ;
  11.  
  12. CREATE TABLE peer (
  13.   peer_id int(10) unsigned NOT NULL PRIMARY KEY,
  14.   peer_info_hash char(20) binary NOT NULL,
  15.   torrent_id int(10) unsigned NOT NULL,
  16.   user_id int(10) unsigned NOT NULL,
  17.   peer_ip int(11) NOT NULL DEFAULT '0',
  18.   peer_port smallint(5) unsigned NOT NULL DEFAULT '0',
  19.   peer_update_time timestamp NOT NULL,
  20.   peer_expire_time timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  21.   peer_left bigint(20) unsigned NOT NULL,
  22.   peer_uploaded bigint(20) unsigned NOT NULL,
  23.   peer_downloaded bigint(20) unsigned NOT NULL,
  24.   peer_upload_speed int(11) unsigned NOT NULL,
  25.   peer_download_speed int(11) unsigned NOT NULL,
  26.   UNIQUE KEY hash(peer_info_hash,peer_ip,peer_port),
  27.   KEY torrent_id (torrent_id),
  28.   KEY peer_left (peer_left),
  29.   KEY peer_expire_time (peer_expire_time),
  30.   KEY peer_update_time (peer_update_time),
  31.   KEY user_id (user_id)
  32. ) TYPE=HEAP;
  33.  
  34. CREATE TABLE session (
  35.   session_id char(40) NOT NULL,
  36.   user_id int(11) unsigned NOT NULL,
  37.   session_ip char(15) NOT NULL,
  38.   session_expire_time datetime NOT NULL,
  39.   PRIMARY KEY (session_id),
  40.   KEY user_id (user_id)
  41. ) TYPE=HEAP;
  42.  
  43. CREATE TABLE torrent (
  44.   torrent_id int(10) unsigned NOT NULL AUTO_INCREMENT,
  45.   torrent_info_hash char(20) binary NOT NULL,
  46.   torrent_downloaded_last_month int(10) unsigned NOT NULL DEFAULT '0',
  47.   torrent_downloaded_this_month int(10) unsigned NOT NULL DEFAULT '0',
  48.   torrent_file_name char(200) NOT NULL,
  49.   torrent_file_path text NOT NULL,
  50.   torrent_size bigint(20) unsigned NOT NULL,
  51.   PRIMARY KEY (torrent_id),
  52.   UNIQUE KEY torrent_info_hash (torrent_info_hash)
  53. ) TYPE=InnoDB  AUTO_INCREMENT=57 ;
  54.  
  55. CREATE TABLE user (
  56.   user_id int(10) unsigned NOT NULL AUTO_INCREMENT,
  57.   user_serial char(40) NOT NULL,
  58.   user_account_status enum('Active','Suspended') NOT NULL,
  59.   user_access_levels text NOT NULL,
  60.   user_torrent_uid char(8) binary NOT NULL,
  61.   user_closure_reason text,
  62.   user_closure_reason_public text,
  63.   user_uploaded_total bigint(20) unsigned NOT NULL DEFAULT '0',
  64.   user_uploaded_month bigint(20) unsigned NOT NULL DEFAULT '0',
  65.   user_uploaded_week bigint(20) unsigned NOT NULL DEFAULT '0',
  66.   user_uploaded_day bigint(20) unsigned NOT NULL DEFAULT '0',
  67.   user_downloaded_total bigint(20) unsigned NOT NULL DEFAULT '0',
  68.   user_downloaded_month bigint(20) unsigned NOT NULL DEFAULT '0',
  69.   user_downloaded_week bigint(20) unsigned NOT NULL DEFAULT '0',
  70.   user_downloaded_day bigint(20) unsigned NOT NULL DEFAULT '0',
  71.   user_webdownloaded_total bigint(20) unsigned NOT NULL DEFAULT '0',
  72.   user_webdownloaded_month bigint(20) unsigned NOT NULL DEFAULT '0',
  73.   user_webdownloaded_week bigint(20) unsigned NOT NULL DEFAULT '0',
  74.   user_webdownloaded_day bigint(20) unsigned NOT NULL DEFAULT '0',
  75.   user_torrentfiles_total int(10) unsigned NOT NULL DEFAULT '0',
  76.   user_torrentfiles_month int(10) unsigned NOT NULL DEFAULT '0',
  77.   user_torrentfiles_week int(10) unsigned NOT NULL DEFAULT '0',
  78.   user_torrentfiles_day int(10) unsigned NOT NULL DEFAULT '0',
  79.   user_no_traffic_limits enum('Y','N') NOT NULL DEFAULT 'N',
  80.   PRIMARY KEY (user_id),
  81.   UNIQUE KEY user_serial (user_serial),
  82.   UNIQUE KEY user_torrent_uid (user_torrent_uid)
  83. ) TYPE=InnoDB  PACK_KEYS=0 AUTO_INCREMENT=3 ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement