1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-23 23:20:57 +01:00

Finish upgrade to new bans table

This commit is contained in:
Michael Foster 2013-09-17 09:23:50 +10:00
parent f53348d7c8
commit c7c297b8a6
2 changed files with 16 additions and 9 deletions

View File

@ -467,6 +467,11 @@ if (file_exists($config['has_installed'])) {
$query->bindValue(':seen', $ban['seen']); $query->bindValue(':seen', $ban['seen']);
$query->execute() or error(db_error($query)); $query->execute() or error(db_error($query));
} }
// Drop old bans table
query("DROP TABLE ``bans``") or error(db_error());
// Replace with new table
query("RENAME TABLE ``bans_new_temp`` TO ``bans``") or error(db_error());
case false: case false:
// Update version number // Update version number
file_write($config['has_installed'], VERSION); file_write($config['has_installed'], VERSION);

View File

@ -40,18 +40,20 @@ CREATE TABLE IF NOT EXISTS `antispam` (
-- --
CREATE TABLE IF NOT EXISTS `bans` ( CREATE TABLE IF NOT EXISTS `bans` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ip` varchar(39) CHARACTER SET ascii NOT NULL, `ipstart` varbinary(16) NOT NULL,
`mod` int(11) NOT NULL COMMENT 'which mod made the ban', `ipend` varbinary(16) DEFAULT NULL,
`set` int(11) NOT NULL, `created` int(10) unsigned NOT NULL,
`expires` int(11) DEFAULT NULL, `expires` int(10) unsigned DEFAULT NULL,
`board` varchar(58) DEFAULT NULL,
`creator` int(10) NOT NULL,
`reason` text, `reason` text,
`board` varchar(58) CHARACTER SET utf8 DEFAULT NULL,
`seen` tinyint(1) NOT NULL, `seen` tinyint(1) NOT NULL,
`post` blob,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `ip` (`ip`), KEY `expires` (`expires`),
KEY `seen` (`seen`) KEY `ipstart` (`ipstart`,`ipend`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ;
-- -------------------------------------------------------- -- --------------------------------------------------------