Browse Source

add indexes

pull/40/head
Savetheinternet 13 years ago
parent
commit
55743a7705
  1. 13
      install.php
  2. 7
      install.sql
  3. 7
      templates/posts.sql

13
install.php

@ -1,6 +1,6 @@
<?php <?php
// Installation/upgrade file // Installation/upgrade file
define('VERSION', 'v0.9.3-dev-8'); define('VERSION', 'v0.9.3-dev-10');
require 'inc/functions.php'; require 'inc/functions.php';
require 'inc/display.php'; require 'inc/display.php';
@ -109,6 +109,17 @@
foreach($boards as &$board) { foreach($boards as &$board) {
query(sprintf("ALTER TABLE `posts_%s` CHANGE `filename` `filename` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL", $board['uri'])) or error(db_error()); query(sprintf("ALTER TABLE `posts_%s` CHANGE `filename` `filename` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL", $board['uri'])) or error(db_error());
} }
case 'v0.9.3-dev-8':
$boards = listBoards();
foreach($boards as &$board) {
query(sprintf("ALTER TABLE `posts_%s` ADD INDEX ( `thread` )", $board['uri'])) or error(db_error());
}
case 'v0.9.3-dev-9':
$boards = listBoards();
foreach($boards as &$board) {
query(sprintf("ALTER TABLE `posts_%s`ADD INDEX ( `time` )", $board['uri'])) or error(db_error());
query(sprintf("ALTER TABLE `posts_%s`ADD FULLTEXT (`body`)", $board['uri'])) 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);

7
install.sql

@ -209,8 +209,11 @@ CREATE TABLE IF NOT EXISTS `posts_b` (
`sticky` int(1) NOT NULL, `sticky` int(1) NOT NULL,
`locked` int(1) NOT NULL, `locked` int(1) NOT NULL,
`embed` text, `embed` text,
UNIQUE KEY `id` (`id`) UNIQUE KEY `id` (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; KEY `thread` (`thread`),
KEY `time` (`time`),
FULLTEXT KEY `body` (`body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
-- --
-- Dumping data for table `posts_b` -- Dumping data for table `posts_b`

7
templates/posts.sql

@ -23,5 +23,8 @@ CREATE TABLE IF NOT EXISTS `posts_{board}` (
`sticky` int(1) NOT NULL, `sticky` int(1) NOT NULL,
`locked` int(1) NOT NULL, `locked` int(1) NOT NULL,
`embed` text, `embed` text,
UNIQUE KEY `id` (`id`) UNIQUE KEY `id` (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; KEY `thread` (`thread`),
KEY `time` (`time`),
FULLTEXT KEY `body` (`body`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

Loading…
Cancel
Save