Witam,
6-10MB to nie jest dużo moja aktualna baza ma 214M w tym, że odseparowałęm skrypty pingujące i dodałem do crontaba (jakies 30 RPC)
Jestem również na etapie migracji stworzyłem strukturę bazy
CREATE TABLE IF NOT EXISTS `articles` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`title` varchar(256) COLLATE utf8_polish_ci NOT NULL,
`text` text COLLATE utf8_polish_ci NOT NULL,
`www` varchar(256) COLLATE utf8_polish_ci NOT NULL,
`keywords` text COLLATE utf8_polish_ci NOT NULL,
`ip` varchar(64) COLLATE utf8_polish_ci NOT NULL,
`ping` int(1) NOT NULL DEFAULT '0',
`verif` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `ban` (
`www` varchar(256) COLLATE utf8_polish_ci NOT NULL,
`ip` varchar(64) COLLATE utf8_polish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
CREATE TABLE IF NOT EXISTS `config` (
`key` varchar(64) COLLATE utf8_polish_ci NOT NULL,
`value` varchar(64) COLLATE utf8_polish_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci;
INSERT INTO `config` (`key`, `value`) VALUES
('cron', '1253101204'),
('ping', '1318042742'),
('add_form', '1'),
('add_mini', '1');
CREATE TABLE IF NOT EXISTS `entries` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`title` varchar(256) COLLATE utf8_polish_ci NOT NULL,
`desc` text COLLATE utf8_polish_ci NOT NULL,
`keywords` text COLLATE utf8_polish_ci NOT NULL,
`www` varchar(256) COLLATE utf8_polish_ci NOT NULL,
`ip` varchar(64) COLLATE utf8_polish_ci NOT NULL,
`ping` int(1) NOT NULL DEFAULT '0',
`verif` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `tags` (
`id` int(32) NOT NULL AUTO_INCREMENT,
`name` text COLLATE utf8_polish_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_polish_ci AUTO_INCREMENT=1 ;
i converter:
<?php
$pdo = new pdo('sqlite:./minigog.sqlite');
//mysql
$link=mysql_connect('localhost','root','');
mysql_select_db('katalog', $link);
// Tags
$q = $pdo->query('select * from tags');
$own = $q->fetchAll();
foreach($own as $key )
{
mysql_query('INSERT INTO `tags` (`id`, `name`) VALUES ( ' . $key['t_id'] . ', \'' . addslashes($key['t_name']) . '\' );', $link);
}
// Articles
$q = $pdo->query('select * from articles');
$own = $q->fetchAll();
foreach($own as $key )
{
mysql_query('INSERT INTO `articles` (`id`, `title`, `text`, `www`, `keywords`, `ip`, `ping`, `verif`) VALUES (
' . $key['a_id'] . ',
\'' . addslashes($key['a_title']) . '\',
\'' . addslashes($key['a_text']) . '\',
\'' . addslashes($key['a_www']) . '\',
\'' . addslashes($key['a_keywords']) . '\',
\'' . $key['a_ip'] . '\',
' . $key['a_ping'] . ',
' . $key['a_verif'] . '
);', $link);
}
// Entries
$q = $pdo->query('select * from entries');
$own = $q->fetchAll();
foreach($own as $key )
{
mysql_query('INSERT INTO `entries` (`id`, `title`, `desc`, `keywords`, `www`, `ip`, `ping`, `verif`) VALUES (
' . $key['e_id'] . ',
\'' . addslashes($key['e_title']) . '\',
\'' . addslashes($key['e_desc']) . '\',
\'' . addslashes($key['e_keywords']) . '\',
\'' . addslashes($key['e_www']) . '\',
\'' . $key['e_ip'] . '\',
' . $key['e_ping'] . ',
' . $key['e_verif'] . '
);', $link);
}
// ban
$q = $pdo->query('select * from ban');
$own = $q->fetchAll();
foreach($own as $key )
{
mysql_query('INSERT INTO `ban` (`www`, `ip`) VALUES (
\'' . addslashes($key['b_www']) . '\',
\'' . addslashes($key['b_ip']) . '\'
);', $link);
}
// config
$q = $pdo->query('select * from config');
$own = $q->fetchAll();
foreach($own as $key )
{
mysql_query('INSERT INTO `config` (`key`, `value`) VALUES (
\'' . addslashes($key['key']) . '\',
' . $key['value'] . '
);', $link);
}
?>
Tylko zostałem zatrzymatrzymany na etapie związanym z kodowaniem kilka polskich znaków jest inna niż powinna...