use [% wp %];
 
/* 1) to utf8, see WordPress.pm for note about why we're not doing this:
 ALTER TABLE [% table_prefix %]_categories CONVERT TO CHARACTER SET 'utf8';
 ALTER TABLE [% table_prefix %]_comments CONVERT TO CHARACTER SET 'utf8';
 ALTER TABLE [% table_prefix %]_linkcategories CONVERT TO CHARACTER SET 'utf8'; 
 ALTER TABLE [% table_prefix %]_links CONVERT TO CHARACTER SET 'utf8'; 
 ALTER TABLE [% table_prefix %]_options CONVERT TO CHARACTER SET 'utf8';
 ALTER TABLE [% table_prefix %]_post2cat CONVERT TO CHARACTER SET 'utf8';
 ALTER TABLE [% table_prefix %]_postmeta CONVERT TO CHARACTER SET 'utf8';
 ALTER TABLE [% table_prefix %]_posts CONVERT TO CHARACTER SET 'utf8';
 ALTER TABLE [% table_prefix %]_usermeta CONVERT TO CHARACTER SET 'utf8';
 ALTER TABLE [% table_prefix %]_users CONVERT TO CHARACTER SET 'utf8';
*/
 
/* 2) new columns */
ALTER TABLE `[% table_prefix %]_categories` ADD COLUMN `link_count` bigint(20) NOT NULL default '0';
ALTER TABLE `[% table_prefix %]_categories` ADD COLUMN `posts_private` tinyint(1) NOT NULL default '0';
ALTER TABLE `[% table_prefix %]_categories` ADD COLUMN `links_private` tinyint(1) NOT NULL default '0';
     
/* 3) new table */
DROP TABLE IF EXISTS `[% table_prefix %]_link2cat`;
CREATE TABLE `[% table_prefix %]_link2cat` (
    `rel_id` bigint(20) NOT NULL auto_increment,
    `link_id` bigint(20) NOT NULL default '0',
    `category_id` bigint(20) NOT NULL default '0',
    PRIMARY KEY  (`rel_id`),
    KEY `link_id` (`link_id`,`category_id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
LOCK TABLES `[% table_prefix %]_link2cat` WRITE;
/*!40000 ALTER TABLE `[% table_prefix %]_link2cat` DISABLE KEYS */;
INSERT INTO `[% table_prefix %]_link2cat` VALUES (1,1,2),(2,2,2),(3,3,2),(4,4,2),(5,5,2),(6,6,2),(7,7,2);
/*!40000 ALTER TABLE `[% table_prefix %]_link2cat` ENABLE KEYS */;
UNLOCK TABLES;

/* 4) new KEY */
ALTER TABLE `[% table_prefix %]_posts` ADD KEY `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`);
