ALTER TABLE NewsCustomData ADD INDEX (ResourceId);

INSERT INTO SearchConfig VALUES ('CustomField', 'RssOriginalURL', 1, 0, 'la_fld_RssOriginalURL', 'lu_fld_RssOriginalURL', 'In-News', 'la_section_CustomFields', 0, 283, 1, 'text', '', '', '', '', '', '', 0);

INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssExpireInterval', 'RssExpireInterval', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssUpdateInterval', 'RssUpdateInterval', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssLastUpdated', 'RssLastUpdated', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssDeleteExpired', 'RssDeleteExpired', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (2, 'RssOriginalURL', 'lu_fld_RssOriginalURL', 'la_section_CustomFields', 'la_fld_RssOriginalURL', 'label', 'cut_first="100"', 0, 1, 0);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssUpdateIntervalType', 'RssUpdateIntervalType', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssSource', 'RssSource', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssExpireIntervalType', 'RssExpireIntervalType', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssDefaultExpiration', 'RssDefaultExpiration', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssDefaultExpirationType', 'RssDefaultExpirationType', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (1, 'RssLastExpired', 'RssLastExpired', 'la_title_SystemCF', NULL, 'text', NULL, 0, 0, 1);
INSERT INTO CustomField (Type, FieldName, FieldLabel, Heading, Prompt, ElementType, ValueList, DisplayOrder, OnGeneralTab, IsSystem) VALUES (2, 'RssArticleCRC', 'RssArticleCRC', 'la_section_SystemCF', NULL, 'text', NULL, 0, 0, 1);

INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news.view', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:innews_general.view', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:innews_general.edit', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_output.view', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_output.edit', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_search.view', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_search.edit', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_email.view', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_email.edit', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_custom.view', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_custom.add', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_custom.edit', 11, 1, 1, 0);
INSERT INTO Permissions (Permission, GroupId, PermissionValue, Type, CatId) VALUES ('in-news:configuration_custom.delete', 11, 1, 1, 0);

UPDATE ConfigurationAdmin SET ValueList = 'Title=la_Article_Title,Excerpt=la_Article_Excerpt,Author=la_Article_Author,CreatedOn=la_Article_Date,Hits=la_Article_Hits,CachedRating=la_Article_Rating,<SQL>SELECT Prompt AS OptionName, CONCAT("cust_", FieldName) AS OptionValue FROM <PREFIX>CustomField WHERE (Type = 2) AND (IsSystem = 0)</SQL>' WHERE VariableName IN ('News_SortField', 'News_SortField2');

UPDATE Modules SET Version = '1.2.0' WHERE Name = 'In-News';