Hello Peter,
I am trying to upgrade the blog module from 5 to 6, but I got an error during upgrade and the whole blog has gone; I then had to restore the site from the backup. I have seen your description on how to recover it (about blog posts and moduleid) and, while the data were still in the database including all the posts, the front-end module disappeared altogether and I could not add it back to the page. What shall I do, please?
This is the error I got during the upgrade:
Violation of PRIMARY KEY constraint 'PK_TabModuleSettings'. Cannot insert duplicate key in object 'dbo.TabModuleSettings'. The duplicate key value is (172, BlogModuleId). The statement has been terminated. at System.Data.SqlClient.SqlConnection. (SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection. (SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at DotNetNuke.Data.SqlDataProvider.ExecuteScriptInternal(String connectionString, String script) ClientConnectionId:e0036cdb-c154-4c50-b3b4-a712da9ce26c /******* SETTINGS *******/ INSERT INTO dbo.TabModuleSettings (TabModuleID, SettingName, SettingValue, CreatedByUserID, CreatedOnDate, LastModifiedByUserID, LastModifiedOnDate) SELECT tm.TabModuleId, 'BlogModuleId', x.ModuleID, -1, GETDATE(), -1, GETDATE() FROM dbo.TabModules tm INNER JOIN dbo.Modules m ON m.ModuleId=tm.ModuleId INNER JOIN dbo.ModuleDefinitions md ON m.ModuleDefID=md.ModuleDefID INNER JOIN ( SELECT DISTINCT m.PortalID, b.ModuleID FROM dbo.Blog_Blogs b INNER JOIN dbo.Modules m ON m.ModuleID=b.ModuleID ) x ON x.PortalID=m.PortalID WHERE md.DefinitionName='Blog' AND m.ModuleID<>x.ModuleID AND NOT EXISTS (SELECT * FROM dbo.TabModuleSettings WHERE TabModuleId=tm.TabModuleId AND SettingName='BlogModuleId')