UPDATE ConfigurationAdmin SET VariableName = 'Link_MinPopVotes', prompt = 'la_fld_Link_MinPopVotes' WHERE VariableName = 'Link_MinVotes';
UPDATE ConfigurationAdmin SET VariableName = 'Link_MinPopRating', prompt = 'la_fld_Link_MinPopRating' WHERE VariableName = 'Link_TopCount';
UPDATE ConfigurationAdmin SET VariableName = 'Link_MaxHotNumber', prompt = 'la_fld_Link_MaxHotNumber' WHERE VariableName = 'Link_VotesToHot';

UPDATE ConfigurationValues SET VariableName = 'Link_MinPopVotes' WHERE VariableName = 'Link_MinVotes';
UPDATE ConfigurationValues SET VariableName = 'Link_MinPopRating' WHERE VariableName = 'Link_TopCount';
UPDATE ConfigurationValues SET VariableName = 'Link_MaxHotNumber' WHERE VariableName = 'Link_VotesToHot';

UPDATE ConfigurationAdmin SET DisplayOrder = '10.01', GroupDisplayOrder = 1 WHERE VariableName = 'Link_SortField';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.01', GroupDisplayOrder = 2 WHERE VariableName = 'Link_SortOrder';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.02', GroupDisplayOrder = 1 WHERE VariableName = 'Link_SortField2';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.02', GroupDisplayOrder = 2 WHERE VariableName = 'Link_SortOrder2';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.03' WHERE VariableName = 'Perpage_Links';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.04' WHERE VariableName = 'Perpage_Links_Short';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.05' WHERE VariableName = 'Link_NewDays';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.06' WHERE VariableName = 'Link_MinPopRating';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.07' WHERE VariableName = 'Link_MinPopVotes';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.08' WHERE VariableName = 'Link_MaxHotNumber';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.09' WHERE VariableName = 'Link_EnhancedLinks';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.10' WHERE VariableName = 'Link_AllowFreeListings';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.11' WHERE VariableName = 'Link_ShowPick';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.12' WHERE VariableName = 'Link_UrlStatus';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.13', GroupDisplayOrder = 1 WHERE VariableName = 'link_ReviewDelay_Value';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.13', GroupDisplayOrder = 2 WHERE VariableName = 'link_ReviewDelay_Interval';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.14', GroupDisplayOrder = 1 WHERE VariableName = 'link_RatingDelay_Value';
UPDATE ConfigurationAdmin SET DisplayOrder = '10.14', GroupDisplayOrder = 2 WHERE VariableName = 'link_RatingDelay_Interval';
UPDATE ConfigurationAdmin SET DisplayOrder = '20.01', GroupDisplayOrder = 1 WHERE VariableName = 'Link_ReviewsSort';
UPDATE ConfigurationAdmin SET DisplayOrder = '20.01', GroupDisplayOrder = 2 WHERE VariableName = 'Link_ReviewsOrder';
UPDATE ConfigurationAdmin SET DisplayOrder = '20.02', GroupDisplayOrder = 1 WHERE VariableName = 'Link_ReviewsSort2';
UPDATE ConfigurationAdmin SET DisplayOrder = '20.02', GroupDisplayOrder = 2 WHERE VariableName = 'Link_ReviewsOrder2';
UPDATE ConfigurationAdmin SET DisplayOrder = '20.03' WHERE VariableName = 'Perpage_LinkReviews';
UPDATE ConfigurationAdmin SET DisplayOrder = '30.01' WHERE VariableName = 'l_CategoryTemplate';
UPDATE ConfigurationAdmin SET DisplayOrder = '30.02' WHERE VariableName = 'l_ItemTemplate';

ALTER TABLE Link CHANGE EditorsPick EditorsPick TINYINT(4) NOT NULL DEFAULT '0';
ALTER TABLE Link CHANGE Status Status TINYINT(4) NOT NULL DEFAULT '2';

INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'l_ItemTemplate', 'l_ItemTemplate', 'la_title_SystemCF', 'l_ItemTemplate', 'text', NULL, 0, 0, 1);

UPDATE Modules SET Version = '3.2.1' WHERE Name = 'In-Link';