# Support for large menu trees
ALTER TABLE `tribalcms_menuitems` add KEY `content_id` (`content_id`);
# Support for menu cache
CREATE TABLE `tribalcms_menu_cache` ( `cache` mediumtext ) ENGINE=MyISAM;
# Support for large amounts of HTML content, especially when in Folder view
ALTER TABLE tribalcms_content_html ADD INDEX version (version);
# Optimizing for large numbers of Shortcut Links
alter table tribalcms_links add index (source_content_id, source_content_version, source_content_type);
# Further optimizing of content tables
ALTER TABLE tribalcms_content_html ADD INDEX (alias);
# Support for larger content fields
ALTER TABLE tribalcms_content_html MODIFY COLUMN content_bodytop MEDIUMTEXT;
ALTER TABLE tribalcms_content_html MODIFY COLUMN content_bodymain MEDIUMTEXT;
ALTER TABLE tribalcms_content_html MODIFY COLUMN content_bodymain MEDIUMTEXT;
ALTER TABLE tribalcms_content_document MODIFY COLUMN content_bodytop MEDIUMTEXT;
ALTER TABLE tribalcms_content_document MODIFY COLUMN content_bodymain MEDIUMTEXT;
ALTER TABLE tribalcms_content_document MODIFY COLUMN content_bodymain MEDIUMTEXT;
ALTER TABLE tribalcms_content_forum MODIFY COLUMN content_bodytop MEDIUMTEXT;
ALTER TABLE tribalcms_content_forum MODIFY COLUMN content_bodymain MEDIUMTEXT;
ALTER TABLE tribalcms_content_forum MODIFY COLUMN content_bodymain MEDIUMTEXT;
# Compliance with phrase distinction between British English and US English
ALTER TABLE tribalcms_super_admins MODIFY COLUMN `use_language_id` varchar(5) NOT NULL default 'en-GB';
# Recorded stats to include info on the type of visitor
alter table tribalcms_stats_raw add visitor_type enum('public', 'extranet_user') not null default 'public' after content_version;
#Fix problem with draft_exists flag:
alter table tribalcms_content_html add draft_exists_new tinyint(1) not null default 0 after status;
update tribalcms_content_html set draft_exists_new = GREATEST(draft_exists-1,0);
# Warning: You should backup your data and eyeball the changes before proceeding with the next step!
alter table tribalcms_content_html drop draft_exists;
alter table tribalcms_content_html change draft_exists_new draft_exists tinyint(1) not null default 0 after status;
alter table tribalcms_content_html_tmp add draft_exists_new tinyint(1) not null default 0 after status;
alter table tribalcms_content_html_tmp drop draft_exists;
alter table tribalcms_content_html_tmp change draft_exists_new draft_exists tinyint(1) not null default 0 after status;