ALTER TABLE SearchConfig CHANGE CustomFieldId CustomFieldId INT(11) NULL DEFAULT NULL;
UPDATE SearchConfig SET CustomFieldId = NULL WHERE CustomFieldId = 0;
UPDATE SearchConfig SET SimpleSearch = -1 WHERE TableName = 'PortalUser' AND ModuleName = 'In-Portal';

INSERT INTO ConfigurationAdmin VALUES ('SearchRel_Keyword_category', 'la_config_SearchRel_DefaultKeyword', 'la_text_keyword', 'text', NULL, NULL, 0, 1);
INSERT INTO ConfigurationAdmin VALUES ('SearchRel_Pop_category', 'la_config_DefaultPop', 'la_text_popularity', 'text', NULL, NULL, 0, 1);
INSERT INTO ConfigurationAdmin VALUES ('SearchRel_Rating_category', 'la_config_DefaultRating', 'la_prompt_Rating', 'text', NULL, NULL, 0, 1);
INSERT INTO ConfigurationAdmin VALUES ('SearchRel_Increase_category', 'la_config_DefaultIncreaseImportance', 'la_text_increase_importance', 'text', NULL, NULL, 0, 1);

UPDATE ConfigurationValues SET Section = 'in-portal:configuration_search' WHERE VariableName LIKE 'SearchRel_%_category' OR VariableName = 'Search_ShowMultiple_category';

CREATE TABLE PortalUserCustomData (CustomDataId int(11) NOT NULL auto_increment, ResourceId int(10) unsigned NOT NULL default '0', UNIQUE KEY ResourceId (ResourceId), PRIMARY KEY  (CustomDataId));
CREATE TABLE CategoryCustomData (CustomDataId int(11) NOT NULL auto_increment, ResourceId int(10) unsigned NOT NULL default '0', UNIQUE KEY ResourceId (ResourceId), PRIMARY KEY  (CustomDataId));

ALTER TABLE Category ADD CategoryTemplate VARCHAR(255) NOT NULL, ADD ItemTemplate VARCHAR(255) NOT NULL, ADD CachedCategoryTemplate VARCHAR(255) NOT NULL, ADD CachedItemTemplate VARCHAR(255) NOT NULL;
ALTER TABLE Category CHANGE AutomaticFilename AutomaticFilename TINYINT(3) UNSIGNED NOT NULL DEFAULT '1';

UPDATE Modules SET Version = '1.1.8' WHERE Name = 'In-Portal';