8. Правим БД (этот пункт со временем будет уменьшаться, т.к. все будет перенесено в скрипт инсталла):
добавляем базы:
Код:
-- Table "peers" DDL
CREATE TABLE `peers` (
`uid` int(11) unsigned NOT NULL,
`fid` int(11) unsigned NOT NULL,
`active` tinyint(4) unsigned NOT NULL,
`announced` int(11) unsigned NOT NULL,
`completed` int(11) unsigned NOT NULL,
`downloaded` bigint(20) unsigned NOT NULL default '0',
`left` bigint(20) unsigned NOT NULL,
`uploaded` bigint(20) unsigned NOT NULL default '0',
`upspeed` bigint(20) unsigned NOT NULL default '0',
`downspeed` bigint(20) unsigned NOT NULL default '0',
`download_sum` bigint(20) unsigned NOT NULL default '0',
`upload_sum` bigint(20) unsigned NOT NULL default '0',
`timespent` bigint(20) unsigned NOT NULL,
`useragent` varchar(255) NOT NULL default '',
`connectable` tinyint(4) unsigned NOT NULL default '1',
`peer_id` char(32) NOT NULL default '',
`ipa` int(11) unsigned NOT NULL,
`port` smallint(5) unsigned NOT NULL default '0',
`mtime` int(11) unsigned NOT NULL,
`pclass` smallint(5) unsigned NOT NULL default '1',
UNIQUE KEY `fid_uid` (`fid`,`uid`),
KEY `connectable` (`connectable`),
KEY `mtime` (`mtime`),
KEY `completed` (`completed`)
) ENGINE=MyISAM;
-- Table "files" DDL
CREATE TABLE `files` (
`fid` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`size` bigint(20) unsigned NOT NULL default '0',
`attachmentid` int(10) unsigned NOT NULL default '0',
PRIMARY KEY (`fid`),
KEY `attachmentid` (`attachmentid`)
) ENGINE=MyISAM;
-- Table "peers_cache" DDL
CREATE TABLE `peers_cache` (
`uid` int(11) unsigned NOT NULL default '0',
`fid` int(11) unsigned NOT NULL default '0',
`downloaded` bigint(20) unsigned NOT NULL default '0',
`left` bigint(20) unsigned NOT NULL default '0',
`uploaded` bigint(20) unsigned NOT NULL default '0',
`upspeed` bigint(20) unsigned NOT NULL default '0',
`downspeed` bigint(20) unsigned NOT NULL default '0',
`connectable` tinyint(4) unsigned NOT NULL default '1',
`peer_id` char(32) NOT NULL default '',
`ipa` int(11) unsigned NOT NULL,
`port` smallint(5) unsigned NOT NULL default '0',
`mtime` int(11) unsigned NOT NULL default '0',
`pclass` smallint(5) unsigned NOT NULL default '1',
`active` tinyint(4) unsigned NOT NULL default '0',
`completed` tinyint(4) unsigned NOT NULL default '0',
`timespent` bigint(20) unsigned NOT NULL default '0',
`download_sum` bigint(20) unsigned NOT NULL default '0',
`upload_sum` bigint(20) unsigned NOT NULL default '0'
) ENGINE=MEMORY;
-- Table "user_cache" DDL
CREATE TABLE `user_cache` (
`userid` int(11) unsigned NOT NULL default '0',
`downloaded` bigint(20) unsigned NOT NULL default '0',
`uploaded` bigint(20) unsigned NOT NULL default '0',
`mtime` int(11) unsigned NOT NULL default '0',
`seeders` tinyint(4) NOT NULL default '0',
`leechers` tinyint(4) NOT NULL default '0',
`timespent` int(11) unsigned NOT NULL default '0'
) ENGINE=MEMORY;
Если памяти мало, можно сделать тип MyISAM